Skip to content

Generalize SQL pushdown to Iceberg/Unity Catalog attached databases - #996

Merged
adsharma merged 1 commit into
LadybugDB:mainfrom
adsharma:feat/sql-pushdown-for-iceberg-unity
Sep 19, 2026
Merged

adsharma merged 1 commit into
LadybugDB:mainfrom
adsharma:feat/sql-pushdown-for-iceberg-unity

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Generalizes the existing SQL pushdown so it works with Iceberg REST and Unity Catalog attached databases, not just DuckDB/Postgres/SQLite file catalogs.

Changes

  • ForeignJoinPushDownOptimizer passes the qualified catalog.schema.table reference through to AttachedDatabase::getTableColumnNames() (which scopes information_schema when supported), with an unqualified fallback so attached databases from older extension builds keep working.
  • Rel-table join columns prefer the src/dst naming convention (the same convention createForeignRelTable uses for FK detection) instead of blindly taking the first two columns, with ordinal-position fallback. SQL catalogs such as Iceberg REST or Unity Catalog do not guarantee endpoint columns come first.
  • ATTACH "did you forget to load…" hint now also covers iceberg/uc_catalog database types.
  • Doc comment updated to list Iceberg/Unity Catalog as supported foreign tables.

Compatibility

Backward compatible in both directions and independently mergeable: new core works with old extension builds (fallback path; verified against the DuckDB/SQLite e2e suites), and old core is unaffected by the extension-side changes.

Companion extensions PR: LadybugDB/extensions#86 (Iceberg ATTACH support, Unity alias/install fixes, shared-catalog hardening). Verified together: join pushdown over an attached DuckDB catalog produces correct pushed SQL with name-detected join keys, and all runnable iceberg/duckdb/sqlite e2e suites pass.

ForeignJoinPushDownOptimizer no longer assumes DuckDB-file-catalog shapes:

- Column lookup passes the qualified catalog.schema.table reference
  through to the attached database (which scopes information_schema when
  it can), with an unqualified fallback so attached databases from older
  extension builds keep working.
- Rel-table join columns prefer the src/dst naming convention (the same
  convention createForeignRelTable uses) instead of blindly taking the
  first two columns, falling back to ordinal position. SQL catalogs such
  as Iceberg REST or Unity Catalog do not guarantee endpoint columns
  come first.
- ATTACH error hint now also suggests loading the iceberg/uc_catalog
  extensions.

Backward compatible in both directions: works with old extension builds
(unqualified fallback) and old core builds are unaffected by the
extension-side changes. Companion extensions PR: LadybugDB/extensions#86.
@adsharma
adsharma force-pushed the feat/sql-pushdown-for-iceberg-unity branch from 2ac3195 to b457d97 Compare September 19, 2026 20:06
@adsharma
adsharma merged commit cbe0ff5 into LadybugDB:main Sep 19, 2026
4 checks passed
@adsharma
adsharma deleted the feat/sql-pushdown-for-iceberg-unity branch September 19, 2026 22:52
adsharma added a commit that referenced this pull request Sep 20, 2026
- Resolve the node-table ID column from the bound catalog entry's
  primary key instead of assuming it is the first foreign column;
  fall back to an `id`-named column before ordinal position.
- Simplify the src/dst endpoint predicate into an isEndpointColumn
  helper shared (by convention) with DuckDBCatalog.
- Document the all-or-nothing endpoint fallback and the unqualified
  table-name fallback trade-off; extract quote-stripping helpers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant