Repository navigation
fix(metadata): normalize native metadata fallbacks - #355
vuanhphung merged 1 commit into
Conversation
There was a problem hiding this comment.
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.
| session_config: HashMap<String, String>, | ||
| ) -> Result<SessionInfo> { | ||
| let url = format!("{}/sessions", self.base_url()); | ||
| let _ = self.session_catalog.set(catalog.map(str::to_owned)); |
There was a problem hiding this comment.
🔵 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.
0a42c4b to
605bf96
Compare
cd87616 to
56d8a1c
Compare
605bf96 to
2cf732c
Compare
56d8a1c to
1299a15
Compare
2cf732c to
25bdb3d
Compare
1299a15 to
2411a62
Compare
25bdb3d to
fe0cd3e
Compare
2411a62 to
78b6b17
Compare
fe0cd3e to
277b1fe
Compare
78b6b17 to
3b2363c
Compare
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
3b2363c to
db84a09
Compare
277b1fe to
879e356
Compare
db84a09
into
feat/native-thrift-metadata-functions
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.