Repository navigation
fix(metadata): literal catalog wildcard and null foreign table conformance - #231
Merged
Merged
Conversation
…mance Two SEA metadata conformance fixes surfaced by the multi-language coverage fan-out, verified against the reference driver behavior: - Catalog match-all wildcard (METADATA-036/037, #202, #221): a literal catalog `%`, `*`, or `""` reaching `build_show_schemas` / `build_show_tables` was broadened to `SHOW … IN ALL CATALOGS`. It now scopes verbatim (`SHOW … IN [CATALOG] \`%\``) and matches nothing (0 rows), mirroring the `build_show_columns` `Option`-based decision. Only a `None` catalog means "all catalogs". This makes an escaped `\%` catalog and an exact `Identifier("%")` return the correct empty result. An unescaped `%` `LikePattern` on `list_tables` is still match-all, and the C ABI NULL/"" → "all catalogs" convention is unchanged. - foreign_keys unspecified foreign table (METADATA-037/038, #212): `Metadata::foreign_keys` with a `None` foreign_table now returns an empty result (0 rows, no `SHOW FOREIGN KEYS` issued) instead of an `InvalidArgument` error, matching the JDBC SEA `listCrossReferences` contract and the ODBC primary-keys-only `SQLForeignKeys` form (covers the parent-set and both-tables-null cases). foreign_catalog / foreign_schema stay required only when a foreign_table is supplied. Updates the C ABI header and doc comments to match, and adds wiremock tripwire tests (literal/escaped `%` catalog scopes verbatim and empties; null and both-null foreign table return empty with zero ExecuteStatement calls) plus builder unit tests. The empty `table_types` filter finding (METADATA-035, #204) was already fixed on main. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
vikrantpuppala
temporarily deployed
to
azure-prod
August 10, 2026 10:38 — with
GitHub Actions
Inactive
vikrantpuppala
temporarily deployed
to
azure-prod
August 10, 2026 10:38 — with
GitHub Actions
Inactive
vikrantpuppala
temporarily deployed
to
azure-prod
August 10, 2026 10:38 — with
GitHub Actions
Inactive
…mas/list_tables The transport trait docs still said "When catalog is None or wildcard, uses SHOW … IN ALL CATALOGS". After the catalog-scoping fix only `None` broadens to all catalogs; a `Some` catalog (including a literal `%` / `*` / `""`) is scoped verbatim and matches no real catalog. Doc-only. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
vikrantpuppala
temporarily deployed
to
azure-prod
August 10, 2026 10:42 — with
GitHub Actions
Inactive
vikrantpuppala
temporarily deployed
to
azure-prod
August 10, 2026 10:42 — with
GitHub Actions
Inactive
vikrantpuppala
temporarily deployed
to
azure-prod
August 10, 2026 10:42 — with
GitHub Actions
Inactive
vikrantpuppala
temporarily deployed
to
azure-prod
August 10, 2026 10:42 — with
GitHub Actions
Inactive
vikrantpuppala
enabled auto-merge
August 10, 2026 10:43
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a cluster of SEA metadata conformance findings from the multi-language coverage fan-out. All target behavior was verified against the reference-driver ground truth (adbc-drivers/databricks #594 for catalog scoping, #609 for cross-reference) — not just the issue's stated "expected".
The findings resolve to two code fixes plus one already-fixed-on-main finding:
1. Catalog match-all wildcard broadened to "all catalogs" (#202, #221 — METADATA-036/037)
SqlCommandBuilder::build_show_schemas/build_show_tablesdecidedSHOW … IN ALL CATALOGSviais_null_or_wildcard(&self.catalog), which returned true for a literal catalog%,*, or"". By the time a catalog reaches these builders asSome(name), it is already a resolved literal (an exactIdentifier, or a\%unescaped bystrip_jdbc_escapesto%) — so a literal%was silently broadened to every catalog instead of matching nothing.Fix: the builders now broaden to "all catalogs" only when the catalog is
None(mirroring the already-correctbuild_show_columns). A literal%/*/""is scoped verbatim (SHOW … IN [CATALOG] \%``) and matches no real catalog → 0 rows, and the server's object-not-found maps to an empty result.%LikePatternonlist_tablesis still genuinely match-all (oneSHOW TABLES IN ALL CATALOGS) — the v0 routing resolves it toNonebefore the builder. Guarded by the existinglist_tables_percent_catalog_uses_single_all_catalogs_querytest, still green.""/ whitespace catalog toNone("all catalogs"), which is the actual ODBC convention. Only a literal%/*(which ODBC does not use for "all") changes, now to the correct 0-row result.2.
foreign_keyswith a NULL foreign table errored instead of returning empty (#212 — METADATA-037/038)Metadata::foreign_keysrejected aNoneforeign_tablewithInvalidArgument. Per the JDBC SEAlistCrossReferencescontract (which keys solely off the foreign table) an unspecified foreign table means "nothing to look up".Fix: a
Noneforeign_tablenow returns an empty result (0 rows, noSHOW FOREIGN KEYS/ExecuteStatement), covering both the parent-set case (METADATA-037) and the both-tables-null case (METADATA-038, where SEA follows JDBC SEA rather than Thrift's 42000). This is also the ODBC primary-keys-onlySQLForeignKeysform.foreign_catalog/foreign_schemaremain required only when aforeign_tableis supplied.3. Empty
table_typesfilter (#204, and #212's METADATA-035) — already fixed onmainreshape_tablesalready treatsSome(&[])the same asNone(match all types), with thetables_empty_types_matches_allunit test asserting it. No code change needed; this PR closes the tracking issue.Downstream / ODBC impact
Per the request to confirm the C ABI / ODBC path: the C ABI's NULL/
""→ "all catalogs" normalization and the empty-table_types→ "all types" convention are both unchanged. The header (include/databricks_kernel.h) and C ABI doc comments forforeign_keyswere updated to document the new NULL-foreign-table → empty-result contract.Test plan
cargo test(full suite incl. doc tests),cargo clippy --all-targets -- -D warnings,cargo +stable fmt --all— all green.list_schemas_literal_percent_catalog_scopes_verbatim_and_emptieslist_tables_escaped_percent_catalog_scopes_verbatim_and_emptiesforeign_keys_null_foreign_table_returns_empty_without_wire_callforeign_keys_both_tables_null_returns_empty_without_wire_call%/*/""catalog scopes verbatim (test_show_schemas_literal_percent_catalog_scopes_verbatim,test_show_tables_literal_percent_catalog_scopes_verbatim, …).list_tables_percent_catalog_uses_single_all_catalogs_query) still passes.Closes #202
Closes #204
Closes #212
Closes #221
This pull request and its description were written by Isaac.