Skip to content

fix(metadata): normalize native metadata fallbacks - #355

Merged
vuanhphung merged 1 commit into
feat/native-thrift-metadata-functionsfrom
fix/native-thrift-metadata-normalization
Sep 24, 2026
Merged

vuanhphung merged 1 commit into
feat/native-thrift-metadata-functionsfrom
fix/native-thrift-metadata-normalization

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Third PR in the native metadata stack; depends on #354.

Stack: #353 → #354 → #355 (this) → #336.

Normalize native metadata values and schemas, preserve resolved function catalogs on fallback, secure SHOW-pattern escaping, and stabilize wildcard metadata coverage.

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

@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 native-metadata normalization (ORDINAL_POSITION +1, REMARKS null→"", TABLE_TYPE empty→"TABLE", integer-width casting, and forcing the resolved catalog into FUNCTION_CAT on fallback) faithfully mirrors the JDBC reference driver's getThriftRows/copyThriftNativeMetadataRows, and the escape_show_pattern change correctly closes a real backslash SQL-injection gap in the SHOW builders (previous jdbc_pattern_to_hive escaped quotes but not backslashes). New wiremock tests cover the explicit/resolved/session-catalog fallback paths and the value normalization. One Low note on the discarded session_catalog.set() result. Nit: the normalization in normalize_native_metadata_batch is keyed purely on column name — fine today since only the intended operations (getTables/getColumns/getFunctions) carry those columns, but a comment tying it to the JDBC parity rationale would help future schema additions avoid accidental over-normalization.

Comment thread src/client/sea.rs
session_config: HashMap<String, String>,
) -> Result<SessionInfo> {
let url = format!("{}/sessions", self.base_url());
let _ = self.session_catalog.set(catalog.map(str::to_owned));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Low — The create_session fallback catalog is cached via session_catalog.set(...) with the Result discarded. This is correct for the normal 1:1 transport→session lifecycle, but because session_catalog is a OnceLock, a second create_session on the same transport (e.g. a future session re-establishment path) would silently keep the first catalog and drop the new one, so session_catalog_or_hive_metastore() would resolve to a stale catalog with no warning. Not reachable today (each SeaRestTransport opens one session), so filing as Low — consider either asserting/logging on a non-first set, or documenting the single-open invariant next to the field.

@vuanhphung
vuanhphung force-pushed the feat/native-thrift-metadata-functions branch from 0a42c4b to 605bf96 Compare September 23, 2026 00:36
@vuanhphung
vuanhphung force-pushed the fix/native-thrift-metadata-normalization branch from cd87616 to 56d8a1c Compare September 23, 2026 00:36
@vuanhphung
vuanhphung force-pushed the feat/native-thrift-metadata-functions branch from 605bf96 to 2cf732c Compare September 23, 2026 00:40
@vuanhphung
vuanhphung force-pushed the fix/native-thrift-metadata-normalization branch from 56d8a1c to 1299a15 Compare September 23, 2026 00:40
@vuanhphung
vuanhphung force-pushed the feat/native-thrift-metadata-functions branch from 2cf732c to 25bdb3d Compare September 23, 2026 00:45
@vuanhphung
vuanhphung force-pushed the fix/native-thrift-metadata-normalization branch from 1299a15 to 2411a62 Compare September 23, 2026 00:45

@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 force-pushed the feat/native-thrift-metadata-functions branch from 25bdb3d to fe0cd3e Compare September 23, 2026 22:37
@vuanhphung
vuanhphung force-pushed the fix/native-thrift-metadata-normalization branch from 2411a62 to 78b6b17 Compare September 23, 2026 22:37
@vuanhphung
vuanhphung force-pushed the feat/native-thrift-metadata-functions branch from fe0cd3e to 277b1fe Compare September 23, 2026 22:40
@vuanhphung
vuanhphung force-pushed the fix/native-thrift-metadata-normalization branch from 78b6b17 to 3b2363c Compare September 23, 2026 22:41

@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.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
@vuanhphung
vuanhphung force-pushed the fix/native-thrift-metadata-normalization branch from 3b2363c to db84a09 Compare September 24, 2026 05:41

@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 merged commit db84a09 into feat/native-thrift-metadata-functions Sep 24, 2026
13 of 15 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — db84a09e Deployed Sep 24, 2026 by vuanhphung via review #700
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