[SPARK-59020][SQL] Support DSv2 Parquet shredded Variant predicate pushdown - #58303
Open
WangGuangxin wants to merge 1 commit into
Open
[SPARK-59020][SQL] Support DSv2 Parquet shredded Variant predicate pushdown#58303WangGuangxin wants to merge 1 commit into
WangGuangxin wants to merge 1 commit into
Conversation
Contributor
Author
|
@dongjoon-hyun @viirya @peter-toth @uros-b Can you help review this when you have time? |
uros-b
reviewed
Aug 26, 2026
uros-b
left a comment
Member
There was a problem hiding this comment.
Seems like a correct and well-contained implementation. The new private[v2] trait keeps the hook internal, the original filters remain above the scan to guarantee result correctness, and the ParquetFilters variant-resolution logic from SPARK-55817 is reused without modification. The test update extends the row-group-skip assertion to cover DSv2 with the vectorized reader, directly validating the new behavior while preserving full correctness coverage across all four reader combinations.
Adding @viirya to take a better look here ^^
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?
This PR enables Parquet predicate pushdown for shredded Variant fields in the DSv2 scan path after #58050
The existing shredded Variant predicate pushdown support can translate filters on
variant_getexpressions into filters on shredded Variant struct fields, so Parquet can use them for row-group
skipping. However, DSv2 regular filter pushdown happens before Variant extraction pushdown, so these
rewritten filters are not available during the normal
pushDownFiltersphase.This PR adds a narrow internal pushdown path for this case:
SupportsPushDownVariantPredicateFiltershook for scan builders.with nested predicate pushdown enabled.
ParquetScanBuilderaccept these Variant predicate filters only when bothspark.sql.parquet.filterPushdownandspark.sql.variant.shreddedPredicatePushdown.enabledare enabled.ParquetScanintoParquetPartitionReaderFactory.contains shredded Variant metadata, and then reuses the existing
ParquetFiltersshredded Variantlogic to build Parquet row-group predicates.
does not change query results.
Why are the changes needed?
Without this change, DSv2 Parquet scans can push Variant extraction into the scan, but predicates
that become pushdown-able only after that rewrite are not passed to Parquet. As a result, queries
filtering on shredded Variant fields may still read row groups that Parquet could otherwise skip.
This is especially useful for Variant columns stored with shredding, where common paths are materialized
as typed Parquet fields. Pushing these predicates to Parquet lets Spark avoid unnecessary IO while
preserving the existing post-scan filter semantics.
Does this PR introduce any user-facing change?
No.
This only improves Parquet row-group skipping for eligible DSv2 scans when existing pushdown-related
configuration is enabled. Query results and visible SQL semantics are unchanged.
How was this patch tested?
Updated
VariantShreddingFilterPushdownSuiteto cover DSv2 shredded Variant predicate pushdown,including row-group skipping assertions for vectorized reads and correctness coverage across DSv1/DSv2
and vectorized/non-vectorized readers.