Repository navigation
[VL] Fix Parquet metadata scans with same-named data columns - #13136
Conversation
|
/delta-test |
|
🔄 Delta Spark UT started by @felipepessoto (~2.5 h). View run |
|
@philo-he @zhouyuan @zhztheplayer could you please review this PR? Thank you! |
There was a problem hiding this comment.
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.
052015f to
de5a5cd
Compare
|
@zhztheplayer could you please review this PR? The rebase onto main is complete, and all 90 CI checks pass on de5a5cd. Thank you! |
de5a5cd to
fd3a503
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
The Parquet files are written undertmpDir_->getPath() + name(seewriteParquet), but… · New The test relies on a strict< 1 MiBfile size assertion to ensure `FILES_MAX_PARTITION_BYTES =… · New This loop comparesinttofunctions.size()(asize_t), which can trigger signed/unsigned… · Newscala.collection.JavaConverters._is deprecated in Scala 2.13+ in favor of… · New
Review effort: Lite
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
4 resolved since last review
The Parquet files are written undertmpDir_->getPath() + name(seewriteParquet), but… The test relies on a strict< 1 MiBfile size assertion to ensure `FILES_MAX_PARTITION_BYTES =…scala.collection.JavaConverters._is deprecated in Scala 2.13+ in favor of… This loop comparesinttofunctions.size()(asize_t), which can trigger signed/unsigned…
Review effort: Lite
3945786 to
824caed
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
3 resolved since last review
Review effort: Lite
8e08819 to
af06c58
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
7 open issues
The PR description says the 12 removed entries use renamed Delta 4.4.1 suite identities, and that… · New The comment on the explicit-schema branch says physical fields and their ordinals must be… · New The two branches each build dataColumns with a separate loop and similar name and type collection… · New The loop variable copies each element of thecolumnTypesvector. Iterate by const reference (`for… · New Setting the file length to the maximumuint64_tvalue is an unexplained magic value. Add a… · New The 1 MB limit is repeated as a literal in two forms (1024 * 1024and\"1m\"). They must stay… · New The index 6 is an unexplained magic number for theidcolumn. It is repeated in several tests… · New
Review effort: Lite
|
@rui-mo, @zhouyuan, @zhztheplayer, could you please review this PR? It fixes Parquet metadata scans failing when metadata fields share names with physical columns. Thanks! |
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>
Use size_t for function-map indices with an explicit protobuf anchor conversion, and use Scala 2.13 collection converters in the Spark 4.1 metadata suite. Leave fixture paths and split-size assertions unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Select incompatible physical types by metadata field name rather than list position. Preserve fixture field order, row data, and existing native/fallback assertions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Document the whole-file split range, share the split-size threshold between assertions and configuration, and derive the fixture id column index from its schema. Preserve production and test behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Clarify the derived-schema branch with the file_name VARCHAR versus physical BIGINT collision and the reader initialization order. No behavior changes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1744c87 to
8a4cb7e
Compare
|
Thanks @rui-mo I rebased and CIs are all green. The previous error was a network issue downloading a package |



What changes are proposed in this pull request?
Fix a valid metadata-only query failing because a user column happens to have the same name as a metadata field:
Expected: the names of the data files, not the stored values
1and2.Before this fix: the native reader fails with:
Why:
_metadata.file_nameis a synthetic string supplied for each file. For scans without an explicit table schema, Gluten reused the complete scan-output schema as the physical reader schema. Parquet therefore tried to read the unrelated physicalfile_name BIGINTasVARCHAR, before the metadata constant could be supplied. The query contains no cast.Fix: build the derived physical schema from regular column roles only. Metadata remains in the scan output but no longer requests a physical field; this query has an empty physical projection. The rule covers all six built-in file constants, not just
file_name.Explicit physical schemas and column ordering, filter binding, and the existing fallback when both same-named real and metadata fields are output remain unchanged. No cast or Scala/Substrait protocol changes. Direct timestamp-metadata filter pushdown is outside scope.
How was this patch tested?
27e9bf905: 82 CI checks passed, 2 skipped, with no failed or pending checks.file_namereproduction failing with baseline libraries and passing with this fix. Those results predate the latest rebase.Was this patch authored or co-authored using generative AI tooling?
Generated-by: GitHub Copilot 1.0.87-0 (GPT-6 Astra)