Skip to content

refactor(csharp): split SEA metadata code by result format - #704

Open
vuanhphung wants to merge 2 commits into
mainfrom
vu-phung/csharp-metadata-format-split
Open

vuanhphung wants to merge 2 commits into
mainfrom
vu-phung/csharp-metadata-format-split

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

What's Changed

Follow-up to #692, implementing the layout proposal from its review. SEA metadata code moves into StatementExecution/Metadata/, with mirrored Native/ and Legacy/ (SHOW) implementations of IMetadataDecoder and IMetadataResultBuilder. Each folder has the same per-operation files, so an operation added to one format only fails the build (primary and foreign keys are decoded only for SHOW; native keys go straight to the builder). MetadataRowReader is now the only place that branches on the format. It also holds the definitions both formats use: DefaultTableType, the table-type match, SHOW column numbering, and the GetObjects ordinal offset. CatalogFilter builds its regex once per filter.

The statement's Get*Async methods no longer branch on IsNative; they pick a builder and return. The SHOW result builders that were inline there, and FlatColumnsResultBuilder, move to Legacy/MetadataResultBuilder. The native primary-key and foreign-key decoders were unused and are removed. Results are unchanged. The result_count and result_tables trace tags are now also emitted for native results.

Comparator run: https://databricks.slack.com/archives/C0B70MDS8DP/p1791872570660359

Unit tests follow the same split: parity tests decode equivalent native and SHOW fixtures and expect identical rows, and format-specific tests cover native catalog re-filtering, Thrift ordering, SHOW parsing, and the SHOW builders' output columns. All 1,175 unit tests pass locally.

This pull request and its description were written by Isaac.

Follow-up to #692. Move SEA metadata decoding and result building into
StatementExecution/Metadata, with mirrored Native/ and Legacy/ (SHOW)
implementations of IMetadataDecoder and IMetadataResultBuilder.
MetadataRowReader is the only place that branches on the format and
holds the rules both formats share, so statement Get*Async methods no
longer branch on IsNative.

Behavior is unchanged. Unit tests are split along the same line and add
parity tests that decode equivalent native and SHOW fixtures.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@peco-review-bot peco-review-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 added integration-test Trigger integration tests in internal repo e2e-test Trigger E2E tests on this PR labels Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Integration tests triggered! View workflow run

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Integration tests triggered! View workflow run

@vuanhphung vuanhphung removed the e2e-test Trigger E2E tests on this PR label Oct 13, 2026
Filter native tables by type before sorting, as on main, and apply the
table-type filter in each decoder. Make MetadataRowReader.Decoder
private and fail fast if a column row is read before it is numbered.
Keep result_count an int, update the design doc, and add tests that
pin GetObjects numbering order and the SHOW result builders' columns.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@peco-review-bot peco-review-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.

@github-actions github-actions Bot removed the integration-test Trigger integration tests in internal repo label Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔒 Integration test approval reset

New commits were pushed to this PR. The integration-test label has been automatically removed for security.

A maintainer must re-review the changes and re-add the label to trigger tests again.

Why is this necessary?
  • New code requires fresh security review
  • Prevents approved PRs from adding malicious code later
  • Ensures all tested code has been explicitly approved

Latest commit: a6c1d60

@vuanhphung vuanhphung added integration-test Trigger integration tests in internal repo e2e-test Trigger E2E tests on this PR labels Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Integration tests triggered! View workflow run

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Integration tests triggered! View workflow run

@vuanhphung

Copy link
Copy Markdown
Collaborator Author

@eric-wang-1990 would you mind taking a look at this?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e-test Trigger E2E tests on this PR integration-test Trigger integration tests in internal repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant