Repository navigation
[GLUTEN-13546][VL] Push literal-on-left comparisons into subfield filters - #13552
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the literal-on-left comparison filtering change.
No open issues 🎉
What changed in this PR
Fixes #13546 by enabling Velox subfield filters for literal-on-left comparisons, allowing Parquet row-group pruning without changing query results.
Changes:
- Swaps operands and mirrors the five supported comparison operators when the column is on the right.
- Adds regression coverage comparing query results and row-group metrics for literal-on-left predicates and their mirrored forms.
| File | Description |
|---|---|
cpp/velox/operators/functions/SparkExprToSubfieldFilterParser.cc |
Normalizes literal-on-left comparisons for existing subfield-filter handling. |
backends-velox/src/test/scala/org/apache/gluten/execution/VeloxMetricsSuite.scala |
Tests equivalent pruning across five comparison operators. |
Review effort: Balanced
Contributor
Author
|
@zhztheplayer @rui-mo Could you take a look? It extends the subfield filter translation in |
zhztheplayer
approved these changes
Nov 10, 2026
Contributor
Author
|
Merge into main. Thank you @zhztheplayer |
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 are proposed in this pull request?
SparkExprToSubfieldFilterParser::leafCallToSubfieldFilteronly recognized a column on the left side of a comparison, so a predicate such as100 > idwas never turned into a subfield filter and could not be used for row group pruning. Spark does not rewrite it, and Gluten passes the Catalyst filter to the native scan as is.When the left operand is not a column and the right one is, the comparison is now rewritten with the operands swapped and the operator mirrored (
100 > idbecomesid < 100) and handled as before. This covers=,<,<=,>and>=. Results do not change, since the predicate was already evaluated as a remaining filter.Fixes #13546.
How was this patch tested?
Added
Literal-on-left comparison prunes Parquet row groupstoVeloxMetricsSuite. It writes a sorted Parquet file with 10 row groups and checks that five literal-on-left predicates skip and read the same row groups as their mirrored forms. Before this change,100 > idread all 10 row groups whileid < 100skipped 9.Was this patch authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Opus.