Skip to content

[VL] Keep synthetic scan metadata out of physical file schemas - #13136

Open
felipepessoto wants to merge 5 commits into
apache:mainfrom
felipepessoto:felipepessoto-metadata-schema-separation
Open

felipepessoto wants to merge 5 commits into
apache:mainfrom
felipepessoto:felipepessoto-metadata-schema-separation

Conversation

@felipepessoto

@felipepessoto felipepessoto commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

Fix metadata-only scans such as SELECT DISTINCT _metadata.file_name failing when a Parquet file also contains a user-defined file_name BIGINT column.

  • Derive physical reader schemas from regular column roles, excluding synthetic metadata while preserving scan outputs and filter binding.
  • Preserve explicit physical schemas, column ordering, and the existing same-name combined-output fallback.
  • Add native/Spark regressions and remove only the 12 verified fixed Delta cases from known-failures.txt.

No Scala/Substrait protocol or cast changes. Direct timestamp-metadata equality pushdown was a pre-existing limitation in the originally tested dependency; residual timestamp filtering is covered.

How was this patch tested?

  • 90/90 CI checks passed on rebased de5a5cdd9 (main 020211a4b), including x86, ARM, enhanced, Spark 3.4-4.2, Delta, Iceberg, and Kafka workflows.
  • Before rebasing, all 12 original Delta cases executed and passed in the Delta v4.2.0 / Spark 4.1 run, with zero new regressions and the unchanged strict baseline gate passing.
  • 111/111 focused metadata and row-index tests passed before rebasing. Coverage includes all six file constants, empty projections/files, aliases, filters, partitions, and positional mapping. Those test sources are unchanged by the rebase, and fresh native/Spark CI passes.
  • The same file_name regression failed with baseline libraries and passed with this fix. Formatting and license checks pass.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: GitHub Copilot 1.0.87-0 (GPT-6 Astra)

@github-actions github-actions Bot added CORE works for Gluten Core VELOX labels Sep 25, 2026
@felipepessoto

Copy link
Copy Markdown
Contributor Author

/delta-test

@github-actions

Copy link
Copy Markdown

🔄 Delta Spark UT started by @felipepessoto (~2.5 h). View run

@github-actions github-actions Bot added the INFRA label Sep 25, 2026
@felipepessoto
felipepessoto marked this pull request as ready for review September 26, 2026 01:45
@felipepessoto

Copy link
Copy Markdown
Contributor Author

@philo-he @zhouyuan @zhztheplayer could you please review this PR? Thank you!

Copilot AI lite review requested due to automatic review settings September 26, 2026 01:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved approval-blocking issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Fixes metadata-only Parquet scans when synthetic metadata names collide with physical columns.

Changes:

  • Separates logical metadata outputs from derived physical reader schemas.
  • Preserves explicit schemas, filters, and positional mapping.
  • Adds Spark/native regressions and removes 12 fixed Delta failures.
File Reviewed change
gluten-ut/​spark41/​src/​test/​scala/​org/​apache/​spark/​sql/​execution/​datasources/​GlutenFileMetadataStructSuite.scala Adds Spark metadata collision and mapping regressions.
cpp/​velox/​tests/​Substrait2VeloxPlanConversionTest.cc Adds native schema and execution tests.
cpp/​velox/​substrait/​SubstraitToVeloxPlan.cc Separates logical scan and physical reader schemas.
.github/​workflows/​util/​delta-spark-ut/​known-failures.txt Removes verified fixed Delta cases.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

felipepessoto and others added 5 commits October 15, 2026 14:29
Derive reader data columns from regular scan slots without changing logical output or filter binding. Preserve explicit physical schemas and existing collision fallback, with native and Spark metadata regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Disable native fixture writes and verify both empty files have readable Parquet footers, zero rows, and the conflicting INT64 field. Avoid the native writer's zero-byte output for empty input.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Serialize scan mapping modes through split metadata instead of using an ignored connector option. Assert mode forwarding and distinguish positional mapping from name mapping. Resolve the overloaded Parquet footer type lookup in the Spark empty-file test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve Spark input-file URIs before checking empty Parquet footers. Exercise a nontrivial native residual timestamp predicate while retaining string/numeric pushdown coverage; direct synthesized timestamp equality is unsupported on both baseline and fixed libraries.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
All twelve original aliasing cases executed and passed in Delta run 36165204380 against merge ac916ff containing PR head 15fd9a3. The unchanged strict comparison reports zero regressions and passes after removing only these twelve stale entries.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings October 15, 2026 21:31
@felipepessoto
felipepessoto force-pushed the felipepessoto-metadata-schema-separation branch from 052015f to de5a5cd Compare October 15, 2026 21:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@felipepessoto

Copy link
Copy Markdown
Contributor Author

@zhztheplayer could you please review this PR? The rebase onto main is complete, and all 90 CI checks pass on de5a5cd. Thank you!

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

CORE works for Gluten Core INFRA VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants