Skip to content

fix(metadata): preserve unknown table types - #506

Merged
rahuls-db merged 4 commits into
mainfrom
rahul-singhal_data/rahul-singhal/default-empty-table-type
Nov 26, 2026
Merged

rahuls-db merged 4 commits into
mainfrom
rahul-singhal_data/rahul-singhal/default-empty-table-type

Conversation

@rahuls-db

@rahuls-db rahuls-db commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Preserve present null and empty tableType metadata values as an empty string, while continuing to default a missing tableType column to TABLE. Legacy Hive Metastore responses can include rows whose type is unknown; retaining those rows under non-empty table-type filters matches existing Thrift behavior for Python and Node kernel-backed drivers.

The behavior is applied consistently to both the SQL-fallback and native metadata paths. Non-empty server-provided table types remain unchanged, and an explicitly empty type filter still returns no rows.

Testing

  • Added focused regression tests for missing, null, empty, and populated table types, including filtered native and SQL-fallback metadata paths.
  • Focused Thrift-versus-kernel comparator, using locally rebuilt drivers:
    • Python: pre-fix 8/8 diffs; post-fix 8/8 matches.
    • Node: pre-fix 8/8 diffs; post-fix 8/8 matches.
  • cargo +stable fmt --all -- --check
  • Focused kernel metadata tests passed.

Additional notes

After this merges, the PECOBLR-4131 and PECOBLR-4164 comparator suppressions can be removed in https://github.com/databricks/databricks-driver-test/pull/2367.


This PR was created with GitHub MCP.

Signed-off-by: Rahul Singhal <rahul.singhal@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.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Low

Looks good, with one low concern. Null and empty values are set to TABLE before the type filter and sort run. That matches JDBC and also avoids putting nulls in the non-nullable TABLE_TYPE field. A nit: since utf8_column already returns all-null for a missing column, the early-return branch could be merged into the null-mapping path.

],
)
.unwrap();
let output = reshape_tables(&batch, Some("main"), None).unwrap();

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 new test only calls reshape_tables with table_types = None. Nothing checks that rows with null or empty types now pass a TABLE filter and are dropped by a VIEW filter. Add a call with Some(&["TABLE"]) and one with Some(&["VIEW"]) and assert the results.

🔀 Found by Claude Opus 5.5 · confirmed by the judge

@vuanhphung vuanhphung left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comment thread src/metadata/thrift_shape.rs Resolved
Signed-off-by: Rahul Singhal <rahul.singhal@databricks.com>
@rahuls-db rahuls-db changed the title fix(metadata): default empty table types fix(metadata): preserve unknown table types Nov 26, 2026
@rahuls-db

Copy link
Copy Markdown
Collaborator Author

Updated the fix to preserve legacy TABLE_TYPE="" rows instead of normalizing them to "TABLE", and to retain those unknown-type rows when a non-empty table-type filter is supplied. This matches existing Thrift behavior and is applied consistently to both the SQL-fallback and native metadata paths.

Focused Thrift-vs-kernel validation using locally rebuilt drivers:

  • Python: pre-fix 8/8 diffs → post-fix 0/8 diffs
  • Node: pre-fix 8/8 diffs → post-fix 0/8 diffs

The focused kernel unit tests also pass. After this merges, we can remove the PECOBLR-4131 and PECOBLR-4164 comparator suppressions.

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

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Low · 1 Nit

Looks good, with 2 low concerns. Null and empty table types are handled the same way on the native and SQL-fallback paths, and the tests cover missing, null, empty and filtered cases. One public rustdoc is now stale, and the new helper duplicates an existing one.

Other findings

  • ⚪ Nit — table_type_column re-implements the null-to-"" substitution that utf8_column_or_empty already does. Return the constant "TABLE" column when tableType is absent, and otherwise call utf8_column_or_empty. (Found by Claude Opus 5.5 · confirmed by the judge)

Comment thread src/metadata/thrift_shape.rs Resolved
Signed-off-by: Rahul Singhal <rahul.singhal@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.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

@rahuls-db
rahuls-db added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 86d42d0 Nov 26, 2026
31 of 32 checks passed

This branch was successfully deployed

1 active deployment
azure-prod — 2d4b52d6 Deployed Nov 26, 2026 by rahuls-db via followup #4316
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.

2 participants