From 12fcfc910862711bdd1df36ff34040a72e690f9d Mon Sep 17 00:00:00 2001 From: Arun Sharma Date: Thu, 21 May 2026 18:56:56 -0700 Subject: [PATCH] Register ADBC extension --- .github/workflows/ci-workflow.yml | 32 ++++++- Makefile | 2 +- extension | 2 +- pixi.toml | 8 ++ .../table/show_official_extensions.cpp | 1 + .../operator/simple/attach_database.cpp | 2 +- test/test_files/function/call/call.test | 83 ++----------------- 7 files changed, 52 insertions(+), 78 deletions(-) create mode 100644 pixi.toml diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index e974ff8fda..2647143341 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -254,6 +254,20 @@ jobs: large-packages: true swap-storage: true + - name: Setup pixi + uses: prefix-dev/setup-pixi@v0.9.4 + with: + pixi-version: v0.68.1 + cache: false + activate-environment: true + + - name: Configure ADBC runtime + run: | + curl -LsSf https://dbc.columnar.tech/install.sh | sh + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + echo "LD_LIBRARY_PATH=${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}" >> "$GITHUB_ENV" + "$HOME/.local/bin/dbc" install --level user duckdb + - name: Setup ccache uses: hendrikmuhs/ccache-action@v1.2 with: @@ -311,7 +325,23 @@ jobs: uv venv - name: Install dependencies - run: uv pip install rangehttpserver requests + run: uv pip install duckdb rangehttpserver requests + + - name: Create ADBC DuckDB fixture + run: | + uv run python - <<'PY' + import duckdb + + con = duckdb.connect("extension/adbc/test/adbc.duckdb") + con.execute("CREATE OR REPLACE TABLE games(id BIGINT, title VARCHAR, score BIGINT)") + con.execute(""" + INSERT INTO games VALUES + (1, 'Portal', 95), + (2, 'Celeste', 94), + (3, 'Hades', 93) + """) + con.close() + PY # shell needs to be built first to generate the dataset provided by the server - name: Extension test build diff --git a/Makefile b/Makefile index 42f55e6029..996450ad7e 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ TEST_JOBS ?= 10 EXTENSION_E2E_TEST_JOBS ?= 1 PGEMBED_PYTHON ?= 3.12 PGEMBED_FIXTURE ?= python3 scripts/run_pgembed_fixture.py -- -EXTENSION_LIST ?= httpfs;duckdb;json;postgres;sqlite;fts;delta;iceberg;azure;unity_catalog;vector;neo4j;algo;llm +EXTENSION_LIST ?= adbc;httpfs;duckdb;json;postgres;sqlite;fts;delta;iceberg;azure;unity_catalog;vector;neo4j;algo;llm EXTENSION_TEST_EXCLUDE_FILTER ?= "" ifeq ($(OS),Windows_NT) diff --git a/extension b/extension index da36651683..7824a2259f 160000 --- a/extension +++ b/extension @@ -1 +1 @@ -Subproject commit da36651683b2dc3668fac4ac84487cfd80f44eb6 +Subproject commit 7824a2259f45929698bce4daa5d48d57aef46c4b diff --git a/pixi.toml b/pixi.toml new file mode 100644 index 0000000000..a3eb1cb60c --- /dev/null +++ b/pixi.toml @@ -0,0 +1,8 @@ +[workspace] +channels = ["conda-forge"] +name = "ladybug-adbc" +platforms = ["linux-64"] + +[dependencies] +libadbc-driver-manager = ">=1.10.0,<2" +libarrow = ">=23.0.1,<24" diff --git a/src/function/table/show_official_extensions.cpp b/src/function/table/show_official_extensions.cpp index c0bdc165f9..b0d63e1e8a 100644 --- a/src/function/table/show_official_extensions.cpp +++ b/src/function/table/show_official_extensions.cpp @@ -12,6 +12,7 @@ namespace lbug { namespace function { static constexpr std::pair extensions[] = { + {"ADBC", "Adds support for reading from ADBC data sources"}, {"ALGO", "Adds support for graph algorithms"}, {"AZURE", "Adds support for reading from azure blob storage"}, {"DELTA", "Adds support for reading from delta tables"}, diff --git a/src/processor/operator/simple/attach_database.cpp b/src/processor/operator/simple/attach_database.cpp index 2e8dc217dc..5e26e38086 100644 --- a/src/processor/operator/simple/attach_database.cpp +++ b/src/processor/operator/simple/attach_database.cpp @@ -52,7 +52,7 @@ void AttachDatabase::executeInternal(ExecutionContext* context) { auto errMsg = std::format("No loaded extension can handle database type: {}.", attachInfo.dbType); auto dbType = common::StringUtils::getLower(attachInfo.dbType); - if (dbType == "duckdb" || dbType == "postgres" || dbType == "sqlite") { + if (dbType == "adbc" || dbType == "duckdb" || dbType == "postgres" || dbType == "sqlite") { errMsg += std::format("\nDid you forget to load {} extension?\nYou can load it by: load " "extension {};", dbType, dbType); diff --git a/test/test_files/function/call/call.test b/test/test_files/function/call/call.test index f3aa4d26bc..b847a755e0 100644 --- a/test/test_files/function/call/call.test +++ b/test/test_files/function/call/call.test @@ -294,93 +294,28 @@ Binder exception: a.fName has type PROPERTY but LITERAL,PARAMETER,PATTERN was ex -STATEMENT CALL SHOW_LOADED_EXTENSIONS() WHERE `extension source` <> 'STATIC LINK' RETURN * ---- 0 --LOG ShowOfficialExtensions --STATEMENT CALL SHOW_OFFICIAL_EXTENSIONS() RETURN * ----- 13 -ALGO|Adds support for graph algorithms -AZURE|Adds support for reading from azure blob storage -DELTA|Adds support for reading from delta tables -DUCKDB|Adds support for reading from duckdb tables -FTS|Adds support for full-text search indexes -HTTPFS|Adds support for reading and writing files over a HTTP(S)/S3 filesystem -ICEBERG|Adds support for reading from iceberg tables -JSON|Adds support for JSON operations -LLM|Adds support for LLM operations -NEO4J|Adds support for migrating nodes and rels from neo4j to lbug -POSTGRES|Adds support for reading from POSTGRES tables -SQLITE|Adds support for reading from SQLITE tables -UNITY_CATALOG|Adds support for scanning delta tables registered in unity catalog - -CASE CallFuncWithYield -LOG CallWithYield --STATEMENT CALL SHOW_OFFICIAL_EXTENSIONS() yield name, description return name, description ----- 13 -ALGO|Adds support for graph algorithms -AZURE|Adds support for reading from azure blob storage -DELTA|Adds support for reading from delta tables -DUCKDB|Adds support for reading from duckdb tables -FTS|Adds support for full-text search indexes -HTTPFS|Adds support for reading and writing files over a HTTP(S)/S3 filesystem -ICEBERG|Adds support for reading from iceberg tables -JSON|Adds support for JSON operations -LLM|Adds support for LLM operations -NEO4J|Adds support for migrating nodes and rels from neo4j to lbug -POSTGRES|Adds support for reading from POSTGRES tables +-STATEMENT CALL SHOW_OFFICIAL_EXTENSIONS() yield name, description WITH name, description WHERE name = 'SQLITE' return name, description +---- 1 SQLITE|Adds support for reading from SQLITE tables -UNITY_CATALOG|Adds support for scanning delta tables registered in unity catalog - --STATEMENT CALL SHOW_OFFICIAL_EXTENSIONS() yield name as extension_name, description as extension_description return extension_name, extension_description ----- 13 -ALGO|Adds support for graph algorithms -AZURE|Adds support for reading from azure blob storage -DELTA|Adds support for reading from delta tables -DUCKDB|Adds support for reading from duckdb tables -FTS|Adds support for full-text search indexes -HTTPFS|Adds support for reading and writing files over a HTTP(S)/S3 filesystem -ICEBERG|Adds support for reading from iceberg tables -JSON|Adds support for JSON operations -LLM|Adds support for LLM operations -NEO4J|Adds support for migrating nodes and rels from neo4j to lbug -POSTGRES|Adds support for reading from POSTGRES tables + +-STATEMENT CALL SHOW_OFFICIAL_EXTENSIONS() yield name as extension_name, description as extension_description WITH extension_name, extension_description WHERE extension_name = 'SQLITE' return extension_name, extension_description +---- 1 SQLITE|Adds support for reading from SQLITE tables -UNITY_CATALOG|Adds support for scanning delta tables registered in unity catalog -LOG ShowConnectionWithoutYieldError -STATEMENT CALL show_connection('workAt') CALL show_connection('workAt') RETURN * ---- error Binder exception: Variable source table name already exists. -LOG ShowExtensionWithYield --STATEMENT CALL SHOW_OFFICIAL_EXTENSIONS() yield name as extension_name, description as extension_description CALL SHOW_OFFICIAL_EXTENSIONS() WHERE extension_name = 'SQLITE' RETURN * ----- 13 -SQLITE|Adds support for reading from SQLITE tables|ALGO|Adds support for graph algorithms -SQLITE|Adds support for reading from SQLITE tables|AZURE|Adds support for reading from azure blob storage -SQLITE|Adds support for reading from SQLITE tables|DELTA|Adds support for reading from delta tables +-STATEMENT CALL SHOW_OFFICIAL_EXTENSIONS() yield name as extension_name, description as extension_description CALL SHOW_OFFICIAL_EXTENSIONS() WHERE extension_name = 'SQLITE' AND name = 'DUCKDB' RETURN * +---- 1 SQLITE|Adds support for reading from SQLITE tables|DUCKDB|Adds support for reading from duckdb tables -SQLITE|Adds support for reading from SQLITE tables|FTS|Adds support for full-text search indexes -SQLITE|Adds support for reading from SQLITE tables|HTTPFS|Adds support for reading and writing files over a HTTP(S)/S3 filesystem -SQLITE|Adds support for reading from SQLITE tables|ICEBERG|Adds support for reading from iceberg tables -SQLITE|Adds support for reading from SQLITE tables|JSON|Adds support for JSON operations -SQLITE|Adds support for reading from SQLITE tables|LLM|Adds support for LLM operations -SQLITE|Adds support for reading from SQLITE tables|NEO4J|Adds support for migrating nodes and rels from neo4j to lbug -SQLITE|Adds support for reading from SQLITE tables|POSTGRES|Adds support for reading from POSTGRES tables -SQLITE|Adds support for reading from SQLITE tables|SQLITE|Adds support for reading from SQLITE tables -SQLITE|Adds support for reading from SQLITE tables|UNITY_CATALOG|Adds support for scanning delta tables registered in unity catalog -LOG ShowExtensionPartialAlias --STATEMENT CALL SHOW_OFFICIAL_EXTENSIONS() yield name, description as extension_description RETURN * ----- 13 -ALGO|Adds support for graph algorithms -AZURE|Adds support for reading from azure blob storage -DELTA|Adds support for reading from delta tables -DUCKDB|Adds support for reading from duckdb tables -FTS|Adds support for full-text search indexes -HTTPFS|Adds support for reading and writing files over a HTTP(S)/S3 filesystem -ICEBERG|Adds support for reading from iceberg tables -JSON|Adds support for JSON operations -LLM|Adds support for LLM operations -NEO4J|Adds support for migrating nodes and rels from neo4j to lbug -POSTGRES|Adds support for reading from POSTGRES tables +-STATEMENT CALL SHOW_OFFICIAL_EXTENSIONS() yield name, description as extension_description WITH name, extension_description WHERE name = 'SQLITE' RETURN * +---- 1 SQLITE|Adds support for reading from SQLITE tables -UNITY_CATALOG|Adds support for scanning delta tables registered in unity catalog -CASE CallFuncWithYieldError -STATEMENT CALL TABLE_INFO('person') yield `property id` as id RETURN *; ---- error