[SPARK-57659][SQL] Make SchemaPruning idempotent after variant pushdown - #57809
Open
goutamadwant wants to merge 1 commit into
Open
[SPARK-57659][SQL] Make SchemaPruning idempotent after variant pushdown#57809goutamadwant wants to merge 1 commit into
goutamadwant wants to merge 1 commit into
Conversation
felipepessoto
approved these changes
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Run
SchemaPruningafterPushVariantIntoScanin the early scan pushdown batch. This removes variant reconstruction projections that become unnecessary during variant pushdown and allows theOncebatch to reach the same plan on its first application.Add a Parquet V1 regression test covering a query that reads
_metadata.file_pathwhile a VARIANT column is referenced below a nondeterministic filter.Closes #57659.
Why are the changes needed?
PushVariantIntoScancan make a variant reconstruction projection unnecessary after the earlier schema-pruning passes have completed. Reapplying the optimizer batch then removes that projection, which violates the idempotence requirement for aOncebatch and causes the reported query to fail during optimization.Running
SchemaPruningonce after variant pushdown makes the first application reach the stable plan.Does this PR introduce any user-facing change?
Yes. Queries that select file metadata while pruning a VARIANT column below a nondeterministic filter no longer fail during optimization with a
Oncebatch idempotence error.How was this patch tested?
The new regression test was confirmed to fail before the optimizer change and pass afterward.
The following tests and checks passed:
./build/sbt 'sql/testOnly org.apache.spark.sql.execution.datasources.parquet.ParquetV1SchemaPruningSuite -- -z "SPARK-57659"'./build/sbt 'sql/testOnly org.apache.spark.sql.execution.datasources.parquet.ParquetV1SchemaPruningSuite org.apache.spark.sql.execution.datasources.PushVariantIntoScanSuite org.apache.spark.sql.execution.datasources.PushVariantIntoScanVectorizedSuite'(349 tests)./build/sbt 'sql/scalastyle' 'sql/Test/scalastyle'git diff --checkThe full
./dev/run-testssuite was not run locally.Was this patch authored or co-authored using generative AI tooling?
AI was used to review the code and understand the existing codebase.
This contribution is my original work, and I license it under the project's open source license.