Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20392 +/- ##
============================================
- Coverage 80.75% 80.75% -0.01%
+ Complexity 35316 35315 -1
============================================
Files 2562 2562
Lines 144141 144146 +5
Branches 17558 17559 +1
============================================
+ Hits 116403 116405 +2
- Misses 19763 19768 +5
+ Partials 7975 7973 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
wombatu-kun
left a comment
There was a problem hiding this comment.
#19169 (closes #18791) already fixes this StartsWith translation with the same max >= prefix AND (min < prefix OR startsWith(min, prefix)) bound, so this PR duplicates it, as did my #20226, which I have closed in its favor. Could we consolidate there and land your data-skipping on/off query test in TestDataSkippingQuery as a follow-up once #19169 merges?
Thanks for pointing this out. I compared the two implementations, and I agree that #19169 should remain the canonical production fix. For non-null binary strings, the bounds are equivalent: this PR uses I’ll close this PR in favor of #19169 and submit the COW/MOR data-skipping on/off query regression test as a focused follow-up after #19169 merges. I also noticed two defensive differences worth discussing separately on #19169: handling missing min/max statistics conservatively, and falling back for Spark 4 non-binary collations. I’ll raise those there rather than maintain a competing |
Describe the issue this Pull Request addresses
Prefix predicates can incorrectly exclude files containing matching records when data skipping uses column statistics.
Currently,
StartsWith(column, prefix)is translated into an equality-style range check:For example, a file containing
abc1andabc9is excluded byname LIKE 'abc%'because its minimum value is greater thanabc, even though both records match.Summary and Changelog
Correct prefix pruning to retain files whose statistics range may overlap the prefix range:
LIKE,startswith, andNOT LIKE.Validation
Executed with Spark 3.5.9 and Java 11:
TestDataSkippingUtils: 64 passed, 1 skipped. The skipped test requires Spark 4 non-binary collation support.TestDataSkippingQuery: all 5 tests passed, including the new COW/MOR regression.git diff --checkpassed.Impact
Prefix queries retain matching files and return correct results when data skipping is enabled.
Predicates outside the supported optimization scope may scan additional files due to conservative fallback. Existing tables require no index rebuild. No configuration, storage-format, or public API changes are introduced.
Risk Level
low
The change is limited to positive prefix-predicate translation. Boundary tests, matching-value checks, and COW/MOR query comparisons verify correctness. Conservative fallback can increase scanning but avoids unsafe pruning.
Documentation Update
none
This restores the intended query behavior without adding configuration or features.
Contributor's checklist