Skip to content

fix(metadata): align GetFunctions with JDBC - #363

Closed
vuanhphung wants to merge 5 commits into
mainfrom
fix/native-thrift-functions
Closed

vuanhphung wants to merge 5 commits into
mainfrom
fix/native-thrift-functions

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

getFunctions previously used information_schema.routines and produced inconsistent catalogs and result shapes between native and fallback metadata paths.

Before After
Catalog selection and FUNCTION_CAT handling differed across metadata paths. Resolve explicit, current, configured-session, then hive_metastore for the SQL query. Native rows preserve the original catalog argument, including null; fallback rows use the resolved catalog.
Function patterns could be embedded after wildcard conversion without reliable SQL escaping. Convert wildcards, then SQL-escape the final pattern exactly once.
Native FUNCTION_TYPE: Int32 failed against the JDBC Int16 schema. Narrow compatible types while preserving server-provided remarks, including null.
Fallback assumed the modern multi-column SHOW FUNCTIONS shape. Support both modern and classic single-function-column results.

This is the function-only subset of closed PR #354; table, column, schema, and key normalization is intentionally excluded.

Testing: cargo +stable fmt --all -- --check, cargo clippy --all-targets -- -D warnings, and cargo test.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Low

Solid, well-tested change that brings getFunctions into line with the JDBC driver — I verified the catalog resolution order, SHOW FUNCTIONS IN CATALOG SQL shape, wildcard→Hive conversion, native-vs-fallback FUNCTION_CAT override, and FUNCTION_TYPE narrowing all match DatabricksMetadataQueryClient/CommandBuilder/MetadataResultSetBuilder. One low-severity inconsistency in REMARKS null handling between the native and fallback paths is worth a look; otherwise no correctness concerns.

Comment thread src/metadata_v0.rs Resolved
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Low

Looks good — the SHOW FUNCTIONS grammar, the null-catalog resolution chain (current-catalog → session catalog → hive_metastore), the once-only SQL escaping in jdbc_pattern_to_hive, and the native-vs-SHOW FUNCTION_CAT handling all match the JDBC reference driver, and the classic single-column fallback is handled via null-filling helpers. One low-severity note: REMARKS null-handling diverges between the native path (normalized to "") and the SHOW fallback path (left null).

Comment thread src/metadata/thrift_shape.rs Resolved
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No issues identified by the review bot.

@vuanhphung vuanhphung closed this Sep 24, 2026

This branch was previously deployed

1 inactive deployment
azure-prod — d52e1b43 Deployed Sep 24, 2026 by vuanhphung via followup #1603
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant