Repository navigation
feat(metadata): request native Thrift result routing - #353
Conversation
There was a problem hiding this comment.
Verdict: 1 High
Solid, well-tested refactor to route native Thrift metadata results and bypass SQL-result reshaping. One high concern: process_native_tables filters the catalog case-sensitively (==) while every sibling filter (including the filter_cross_reference_by_parent added in this same PR) uses eq_ignore_ascii_case, which can silently drop all rows for mixed-case catalog names against canonically-cased native results.
286f67a to
098bfae
Compare
098bfae to
7157f29
Compare
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
7157f29 to
ace712d
Compare
There was a problem hiding this comment.
Verdict: 2 Low
Looks good — the native-metadata routing is coherent: both native and legacy paths converge on the kernel's canonical JDBC column names/order, the wildcard fan-out still enumerates catalogs via TABLE_CAT regardless of path, and applying filter_cross_reference_by_parent to the legacy foreign-keys path too is a genuine correctness improvement (the SHOW grammar ignores parent identifiers server-side). Two Low notes: the positional schema reattachment trusts server column order for all-Utf8 schemas (silent-mislabel risk if the contract is ever violated), and the native bypass routing lacks wire-level test coverage beyond catalogs.
| /// Reattach the kernel's public schema so empty and non-empty responses expose | ||
| /// the same stable Arrow contract, while deliberately skipping the SQL-result | ||
| /// reshape. | ||
| fn normalize_native_metadata_batch( |
There was a problem hiding this comment.
🔵 Low — normalize_native_metadata_batch reattaches the kernel's public schema to the native columns purely by position: RecordBatch::try_new(schema, batch.columns().to_vec()). try_new validates column count and DataType, but several native schemas are entirely Utf8 (e.g. GET_TABLES_SCHEMA's 10 columns, GET_CATALOGS_SCHEMA's single column). If the native backend ever returns those columns in a different order, the mismatch is invisible to the type check and the kernel would silently mislabel columns (e.g. TABLE_SCHEM values under TABLE_NAME).
This rests entirely on the server-contract invariant that native results are already in canonical Thrift column order. That's a reasonable assumption for this PR, but since the failure mode is silent data corruption rather than a loud error, consider asserting the incoming column names match the target schema (or at least documenting the invariant at the call sites) before trusting the order.
| Some(catalog.as_str()), | ||
| types_ref.as_deref(), | ||
| )?); | ||
| out.push(if native { |
There was a problem hiding this comment.
🔵 Low — The native-result bypass is wired into list_tables, list_columns, list_schemas, foreign_keys, list_catalogs, etc., but the only wire-level (wiremock) coverage added is native_catalogs_header_and_result_bypass_show_reshape. The new unit tests exercise the filter helpers (process_native_tables, filter_cross_reference_by_parent) directly, but nothing drives a native is_native_metadata_result: true manifest through the list_tables / list_columns / foreign_keys routing where process_native_tables and filter_cross_reference_by_parent are actually invoked from the reshape closure. A regression in that routing (e.g. the native branch calling the wrong helper, or the parent-filter being dropped) would pass CI. Consider adding wiremock tests mirroring the catalogs one for at least the tables and cross-reference native paths.
First PR in the native metadata stack.
Stack: #353 (this) → #354 → #355 → #336.
Send SEA metadata operation/native-result headers, honor
manifest.is_native_metadata_result, and bypass SQL-result reshaping while retaining legacy fallbacks and client-side filters.Testing:
cargo +stable fmt --all,cargo clippy --all-targets -- -D warnings,cargo test.