From 1b54f329106b1bd47c3b4820b826519a83fa031e Mon Sep 17 00:00:00 2001 From: shekharrajak Date: Sat, 7 Feb 2026 12:56:24 +0530 Subject: [PATCH 1/4] feat(playground): add SQL catalog support --- Cargo.lock | 3 + crates/integrations/playground/Cargo.toml | 5 + crates/integrations/playground/src/catalog.rs | 119 +++++++++++++++++- 3 files changed, 121 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 054de94e68..a1ef734a24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3591,13 +3591,16 @@ dependencies = [ "home", "iceberg", "iceberg-catalog-rest", + "iceberg-catalog-sql", "iceberg-datafusion", "mimalloc", + "sqlx", "stacker", "tokio", "toml", "tracing", "tracing-subscriber", + "uuid", ] [[package]] diff --git a/crates/integrations/playground/Cargo.toml b/crates/integrations/playground/Cargo.toml index 3f6774be19..28878ae46a 100644 --- a/crates/integrations/playground/Cargo.toml +++ b/crates/integrations/playground/Cargo.toml @@ -36,7 +36,9 @@ fs-err = { workspace = true } home = { workspace = true } iceberg = { workspace = true } iceberg-catalog-rest = { workspace = true } +iceberg-catalog-sql = { workspace = true } iceberg-datafusion = { workspace = true } +sqlx = { workspace = true, features = ["runtime-tokio", "sqlite", "migrate"] } mimalloc = { workspace = true } stacker = { workspace = true } tokio = { workspace = true } @@ -44,6 +46,9 @@ toml = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true } +[dev-dependencies] +uuid = { workspace = true, features = ["v4"] } + [package.metadata.cargo-machete] # These dependencies are added to ensure minimal dependency version ignored = ["stacker", "mimalloc", "home"] diff --git a/crates/integrations/playground/src/catalog.rs b/crates/integrations/playground/src/catalog.rs index f7fd14ca84..df689355a8 100644 --- a/crates/integrations/playground/src/catalog.rs +++ b/crates/integrations/playground/src/catalog.rs @@ -25,6 +25,7 @@ use datafusion::catalog::{CatalogProvider, CatalogProviderList}; use fs_err::read_to_string; use iceberg::CatalogBuilder; use iceberg_catalog_rest::RestCatalogBuilder; +use iceberg_catalog_sql::SqlCatalogBuilder; use iceberg_datafusion::IcebergCatalogProvider; use toml::{Table as TomlTable, Value}; @@ -78,10 +79,6 @@ impl IcebergCatalogList { .as_str() .ok_or_else(|| anyhow::anyhow!("type is not string"))?; - if r#type != "rest" { - return Err(anyhow::anyhow!("Only rest catalog is supported for now!")); - } - let catalog_config = config .get("config") .ok_or_else(|| anyhow::anyhow!("config not found for catalog {name}"))? @@ -96,11 +93,21 @@ impl IcebergCatalogList { .ok_or_else(|| anyhow::anyhow!("props {key} is not string"))?; props.insert(key.to_string(), value_str.to_string()); } - let catalog = RestCatalogBuilder::default().load(name, props).await?; + + // Create catalog based on type using the appropriate builder + let catalog: Arc = match r#type { + "rest" => Arc::new(RestCatalogBuilder::default().load(name, props).await?), + "sql" => Arc::new(SqlCatalogBuilder::default().load(name, props).await?), + _ => { + return Err(anyhow::anyhow!( + "Unsupported catalog type: '{type}'. Supported types: rest, sql" + )); + } + }; Ok(( name.to_string(), - Arc::new(IcebergCatalogProvider::try_new(Arc::new(catalog)).await?), + Arc::new(IcebergCatalogProvider::try_new(catalog).await?), )) } } @@ -129,3 +136,103 @@ impl CatalogProviderList for IcebergCatalogList { .map(|c| c.clone() as Arc) } } + +#[cfg(test)] +mod tests { + use sqlx::migrate::MigrateDatabase; + + use super::*; + + fn temp_path() -> String { + let uuid = uuid::Uuid::new_v4(); + format!("/tmp/iceberg-test-{}", uuid) + } + + #[tokio::test] + async fn test_parse_sql_catalog() { + let db_path = temp_path(); + let sql_uri = format!("sqlite:{db_path}"); + + // Create the SQLite database file first + sqlx::Sqlite::create_database(&sql_uri).await.unwrap(); + + let config = format!( + r#" + [[catalogs]] + name = "test_sql" + type = "sql" + [catalogs.config] + uri = "{sql_uri}" + warehouse = "/tmp/sql-warehouse" + "# + ); + + let toml_table: TomlTable = toml::from_str(&config).unwrap(); + let catalog_list = IcebergCatalogList::parse_table(&toml_table).await.unwrap(); + + assert!( + catalog_list + .catalog_names() + .contains(&"test_sql".to_string()) + ); + assert!(catalog_list.catalog("test_sql").is_some()); + } + + #[tokio::test] + async fn test_parse_unsupported_catalog_type() { + let config = r#" + [[catalogs]] + name = "test_hive" + type = "hive" + [catalogs.config] + uri = "thrift://localhost:9083" + "#; + + let toml_table: TomlTable = toml::from_str(config).unwrap(); + let result = IcebergCatalogList::parse_table(&toml_table).await; + + assert!(result.is_err()); + let err_msg = result.unwrap_err().to_string(); + assert!(err_msg.contains("Unsupported catalog type")); + assert!(err_msg.contains("hive")); + assert!(err_msg.contains("rest, sql")); + } + + #[tokio::test] + async fn test_catalog_names() { + let db_path1 = temp_path(); + let db_path2 = temp_path(); + let sql_uri1 = format!("sqlite:{db_path1}"); + let sql_uri2 = format!("sqlite:{db_path2}"); + + // Create SQLite database files first + sqlx::Sqlite::create_database(&sql_uri1).await.unwrap(); + sqlx::Sqlite::create_database(&sql_uri2).await.unwrap(); + + let config = format!( + r#" + [[catalogs]] + name = "catalog_one" + type = "sql" + [catalogs.config] + uri = "{sql_uri1}" + warehouse = "/tmp/warehouse1" + + [[catalogs]] + name = "catalog_two" + type = "sql" + [catalogs.config] + uri = "{sql_uri2}" + warehouse = "/tmp/warehouse2" + "# + ); + + let toml_table: TomlTable = toml::from_str(&config).unwrap(); + let catalog_list = IcebergCatalogList::parse_table(&toml_table).await.unwrap(); + + let names = catalog_list.catalog_names(); + assert_eq!(names.len(), 2); + assert!(names.contains(&"catalog_one".to_string())); + assert!(names.contains(&"catalog_two".to_string())); + } +} From cbd87e51e58c744b470e8d196598750a5c42a989 Mon Sep 17 00:00:00 2001 From: shekharrajak Date: Tue, 17 Feb 2026 10:09:47 +0530 Subject: [PATCH 2/4] fix: inline format args for clippy compliance --- crates/integrations/playground/src/catalog.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/integrations/playground/src/catalog.rs b/crates/integrations/playground/src/catalog.rs index df689355a8..c00049f214 100644 --- a/crates/integrations/playground/src/catalog.rs +++ b/crates/integrations/playground/src/catalog.rs @@ -145,7 +145,7 @@ mod tests { fn temp_path() -> String { let uuid = uuid::Uuid::new_v4(); - format!("/tmp/iceberg-test-{}", uuid) + format!("/tmp/iceberg-test-{uuid}") } #[tokio::test] From bf645e6fe61d71282f3f699db2ec0d8b42b1e9de Mon Sep 17 00:00:00 2001 From: shekharrajak Date: Tue, 24 Feb 2026 10:26:44 +0530 Subject: [PATCH 3/4] Merge upstream/main into feat/playground-sql-catalog Combines SQL catalog support (from feature branch) with memory catalog support (from upstream main). Both catalog types are now supported: - rest - sql - memory --- .github/workflows/audit.yml | 3 + .github/workflows/bindings_python_ci.yml | 6 +- .github/workflows/ci.yml | 7 + .github/workflows/ci_typos.yml | 5 +- .github/workflows/codeql.yml | 54 +++++ .github/workflows/publish.yml | 5 +- .github/workflows/release_python.yml | 8 +- .github/workflows/release_python_nightly.yml | 1 + .github/workflows/stale.yml | 2 +- .github/workflows/website.yml | 3 + Cargo.lock | 208 ++++++++++++++++-- crates/integrations/playground/src/catalog.rs | 50 +++-- 12 files changed, 303 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index a86c58e5c7..abe0c377c5 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -36,6 +36,9 @@ on: schedule: - cron: '0 0 * * *' +permissions: + contents: read + jobs: security_audit: runs-on: ubuntu-latest diff --git a/.github/workflows/bindings_python_ci.yml b/.github/workflows/bindings_python_ci.yml index ed2c03b763..a78f27b0b1 100644 --- a/.github/workflows/bindings_python_ci.yml +++ b/.github/workflows/bindings_python_ci.yml @@ -40,6 +40,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true +permissions: + contents: read + jobs: check-rust: runs-on: ubuntu-latest @@ -75,6 +78,7 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: + max-parallel: 15 matrix: os: - ubuntu-latest @@ -89,7 +93,7 @@ jobs: with: working-directory: "bindings/python" command: build - args: --out dist --sdist + args: --out dist - uses: astral-sh/setup-uv@v7 with: version: "0.9.3" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe7476a80e..ea2257b676 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,10 +40,14 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true +permissions: + contents: read + jobs: check: runs-on: ${{ matrix.os }} strategy: + max-parallel: 15 matrix: os: - ubuntu-latest @@ -80,6 +84,7 @@ jobs: build: runs-on: ${{ matrix.os }} strategy: + max-parallel: 15 matrix: os: - ubuntu-latest @@ -105,6 +110,7 @@ jobs: build_with_no_default_features: runs-on: ${{ matrix.os }} strategy: + max-parallel: 15 matrix: os: - ubuntu-latest @@ -125,6 +131,7 @@ jobs: tests: runs-on: ubuntu-latest strategy: + max-parallel: 15 matrix: test-suite: - { name: "default", args: "--all-targets --all-features --workspace" } diff --git a/.github/workflows/ci_typos.yml b/.github/workflows/ci_typos.yml index 13ceeaf236..38541bffbc 100644 --- a/.github/workflows/ci_typos.yml +++ b/.github/workflows/ci_typos.yml @@ -32,6 +32,9 @@ concurrency: env: RUST_BACKTRACE: 1 +permissions: + contents: read + jobs: typos-check: name: typos check @@ -42,4 +45,4 @@ jobs: steps: - uses: actions/checkout@v6 - name: Check typos - uses: crate-ci/typos@v1.43.3 + uses: crate-ci/typos@v1.43.5 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..7fef7973e5 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,54 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '16 4 * * 1' + +permissions: + contents: read + +jobs: + analyze: + name: Analyze Actions + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + packages: read + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: actions + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:actions" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6b4b3da841..4504f6e2f0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,12 +26,15 @@ on: - "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" workflow_dispatch: +permissions: + contents: read + jobs: publish: runs-on: ubuntu-latest strategy: # Publish package one by one instead of flooding the registry - max-parallel: 1 + max-parallel: 15 matrix: # Order here is sensitive, as it will be used to determine the order of publishing package: diff --git a/.github/workflows/release_python.yml b/.github/workflows/release_python.yml index e587b50adc..f4cf4a761a 100644 --- a/.github/workflows/release_python.yml +++ b/.github/workflows/release_python.yml @@ -55,11 +55,14 @@ jobs: # Use input for workflow_dispatch, otherwise use `workflow_run.head_branch` # Note, `workflow_run.head_branch` does not contain `refs/tags/` prefix, just the tag name, i.e. `v0.4.0` or `v0.4.0-rc.1` # Valid formats: v.. OR v..-rc. + env: + DISPATCH_RELEASE_TAG: ${{ github.event.inputs.release_tag }} + RUN_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} run: | if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - RELEASE_TAG="${{ github.event.inputs.release_tag }}" + RELEASE_TAG="$DISPATCH_RELEASE_TAG" else - RELEASE_TAG="${{ github.event.workflow_run.head_branch }}" + RELEASE_TAG="$RUN_HEAD_BRANCH" fi echo "Validating release tag: $RELEASE_TAG" if [[ ! "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$ ]]; then @@ -142,6 +145,7 @@ jobs: runs-on: "${{ matrix.os }}" needs: [validate-release-tag] strategy: + max-parallel: 15 matrix: include: - { os: windows-latest } diff --git a/.github/workflows/release_python_nightly.yml b/.github/workflows/release_python_nightly.yml index 8bdd9d1003..32614b2d0e 100644 --- a/.github/workflows/release_python_nightly.yml +++ b/.github/workflows/release_python_nightly.yml @@ -63,6 +63,7 @@ jobs: if: github.repository == 'apache/iceberg-rust' # Only run for apache repo runs-on: "${{ matrix.os }}" strategy: + max-parallel: 15 matrix: include: - { os: windows-latest } diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 95a4fdc256..051e9395fc 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -31,7 +31,7 @@ jobs: if: github.repository_owner == 'apache' runs-on: ubuntu-22.04 steps: - - uses: actions/stale@v10.1.1 + - uses: actions/stale@v10.2.0 with: stale-issue-label: 'stale' exempt-issue-labels: 'not-stale' diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 1a52482b08..59bd2c6f2c 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -30,6 +30,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index a1ef734a24..57c68ea40a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,7 +120,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -131,7 +131,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -244,9 +244,9 @@ dependencies = [ [[package]] name = "arrow-arith" -version = "57.2.0" +version = "57.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "288015089e7931843c80ed4032c5274f02b37bcb720c4a42096d50b390e70372" +checksum = "f7b3141e0ec5145a22d8694ea8b6d6f69305971c4fa1c1a13ef0195aef2d678b" dependencies = [ "arrow-array", "arrow-buffer", @@ -289,9 +289,9 @@ dependencies = [ [[package]] name = "arrow-cast" -version = "57.2.0" +version = "57.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8e372ed52bd4ee88cc1e6c3859aa7ecea204158ac640b10e187936e7e87074" +checksum = "646bbb821e86fd57189c10b4fcdaa941deaf4181924917b0daa92735baa6ada5" dependencies = [ "arrow-array", "arrow-buffer", @@ -2497,7 +2497,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2650,7 +2650,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2995,6 +2995,19 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", + "wasip3", +] + [[package]] name = "glob" version = "0.3.3" @@ -3714,6 +3727,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "ident_case" version = "1.0.1" @@ -3870,7 +3889,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3943,6 +3962,12 @@ dependencies = [ "spin", ] +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "lexical-core" version = "1.0.6" @@ -4190,9 +4215,9 @@ dependencies = [ [[package]] name = "minijinja" -version = "2.15.1" +version = "2.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b479616bb6f0779fb0f3964246beda02d4b01144e1b0d5519616e012ccc2a245" +checksum = "5c54f3bcc034dd74496b5ca929fd0b710186672d5ff0b0f255a9ceb259042ece" dependencies = [ "serde", ] @@ -4391,7 +4416,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5708,15 +5733,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -6719,15 +6744,15 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.23.0" +version = "3.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1" dependencies = [ "fastrand", "getrandom 0.3.4", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -7267,6 +7292,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "unit-prefix" version = "0.5.2" @@ -7317,11 +7348,11 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.20.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" +checksum = "b672338555252d43fd2240c714dc444b8c6fb0a5c5335e65a07bba7742735ddb" dependencies = [ - "getrandom 0.3.4", + "getrandom 0.4.1", "js-sys", "serde_core", "wasm-bindgen", @@ -7438,7 +7469,16 @@ version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.46.0", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", ] [[package]] @@ -7505,6 +7545,28 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.12.1", + "wasm-encoder", + "wasmparser", +] + [[package]] name = "wasm-streams" version = "0.4.2" @@ -7518,6 +7580,18 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap 2.12.1", + "semver", +] + [[package]] name = "web-sys" version = "0.3.83" @@ -7572,7 +7646,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] @@ -7880,6 +7954,94 @@ version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap 2.12.1", + "prettyplease", + "syn 2.0.111", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.111", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap 2.12.1", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.12.1", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "writeable" version = "0.6.2" diff --git a/crates/integrations/playground/src/catalog.rs b/crates/integrations/playground/src/catalog.rs index c00049f214..17ea70d955 100644 --- a/crates/integrations/playground/src/catalog.rs +++ b/crates/integrations/playground/src/catalog.rs @@ -24,6 +24,7 @@ use anyhow::anyhow; use datafusion::catalog::{CatalogProvider, CatalogProviderList}; use fs_err::read_to_string; use iceberg::CatalogBuilder; +use iceberg::memory::MemoryCatalogBuilder; use iceberg_catalog_rest::RestCatalogBuilder; use iceberg_catalog_sql::SqlCatalogBuilder; use iceberg_datafusion::IcebergCatalogProvider; @@ -98,9 +99,10 @@ impl IcebergCatalogList { let catalog: Arc = match r#type { "rest" => Arc::new(RestCatalogBuilder::default().load(name, props).await?), "sql" => Arc::new(SqlCatalogBuilder::default().load(name, props).await?), + "memory" => Arc::new(MemoryCatalogBuilder::default().load(name, props).await?), _ => { return Err(anyhow::anyhow!( - "Unsupported catalog type: '{type}'. Supported types: rest, sql" + "Unsupported catalog type: '{type}'. Supported types: rest, sql, memory" )); } }; @@ -178,6 +180,27 @@ mod tests { assert!(catalog_list.catalog("test_sql").is_some()); } + #[tokio::test] + async fn test_parse_memory_catalog() { + let config = r#" + [[catalogs]] + name = "test_memory" + type = "memory" + [catalogs.config] + warehouse = "/tmp/test-warehouse" + "#; + + let toml_table: TomlTable = toml::from_str(config).unwrap(); + let catalog_list = IcebergCatalogList::parse_table(&toml_table).await.unwrap(); + + assert!( + catalog_list + .catalog_names() + .contains(&"test_memory".to_string()) + ); + assert!(catalog_list.catalog("test_memory").is_some()); + } + #[tokio::test] async fn test_parse_unsupported_catalog_type() { let config = r#" @@ -195,39 +218,26 @@ mod tests { let err_msg = result.unwrap_err().to_string(); assert!(err_msg.contains("Unsupported catalog type")); assert!(err_msg.contains("hive")); - assert!(err_msg.contains("rest, sql")); + assert!(err_msg.contains("rest, sql, memory")); } #[tokio::test] async fn test_catalog_names() { - let db_path1 = temp_path(); - let db_path2 = temp_path(); - let sql_uri1 = format!("sqlite:{db_path1}"); - let sql_uri2 = format!("sqlite:{db_path2}"); - - // Create SQLite database files first - sqlx::Sqlite::create_database(&sql_uri1).await.unwrap(); - sqlx::Sqlite::create_database(&sql_uri2).await.unwrap(); - - let config = format!( - r#" + let config = r#" [[catalogs]] name = "catalog_one" - type = "sql" + type = "memory" [catalogs.config] - uri = "{sql_uri1}" warehouse = "/tmp/warehouse1" [[catalogs]] name = "catalog_two" - type = "sql" + type = "memory" [catalogs.config] - uri = "{sql_uri2}" warehouse = "/tmp/warehouse2" - "# - ); + "#; - let toml_table: TomlTable = toml::from_str(&config).unwrap(); + let toml_table: TomlTable = toml::from_str(config).unwrap(); let catalog_list = IcebergCatalogList::parse_table(&toml_table).await.unwrap(); let names = catalog_list.catalog_names(); From 74d63b14e49656b1b4213ccf84d012cdf3623d11 Mon Sep 17 00:00:00 2001 From: shekharrajak Date: Tue, 24 Feb 2026 11:21:39 +0530 Subject: [PATCH 4/4] fix: complete match arm syntax and remove duplicate import - Add missing closing delimiters )); and } for unsupported catalog type error - Remove duplicate `use super::*;` statement in tests module --- crates/integrations/playground/src/catalog.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/integrations/playground/src/catalog.rs b/crates/integrations/playground/src/catalog.rs index 6d48065c73..17ea70d955 100644 --- a/crates/integrations/playground/src/catalog.rs +++ b/crates/integrations/playground/src/catalog.rs @@ -103,6 +103,8 @@ impl IcebergCatalogList { _ => { return Err(anyhow::anyhow!( "Unsupported catalog type: '{type}'. Supported types: rest, sql, memory" + )); + } }; Ok(( @@ -178,8 +180,6 @@ mod tests { assert!(catalog_list.catalog("test_sql").is_some()); } - use super::*; - #[tokio::test] async fn test_parse_memory_catalog() { let config = r#"