voonhous opened a new pull request, #20541: URL: https://github.com/apache/hudi/pull/20541
### Describe the issue this Pull Request addresses Fixes #20537 Stacked on #20540: review only the last commit, `fix(spark): range filters on expression index`. A column stats expression index pruned only `=` and `IN` filters. `hour(ts) > 12`, `BETWEEN`, `<`, `>=` scanned every file. ### Summary and Changelog - `ExpressionIndexSupport.findIndexUses`: drop the `=` / `IN` gate that #20540 kept. The data skipping stages compile every filter form on the indexed `f(col)`, as for column stats: comparisons, `BETWEEN`, `NOT`, arithmetic over `f(col)`. - A bloom filter expression index still reads only `=` and `IN`: a range gives no keys, so it is skipped instead of being probed as a key. On the #20537 table (one base file per partition), each of these now scans 1 file instead of 3: `hour(ts) > 12`, `BETWEEN 12 AND 24`, `NOT hour(ts) <= 12`, `hour(ts) < 5`, `hour(ts) + 1 >= 17`. ### Impact Range filters on an expression index prune files. Results are unchanged. ### Risk Level low. Ranges go through the same stages as column stats ranges. Tests: - `TestExpressionIndex#Test Expression Index Reads Filters On Its Own Expression`: the five ranges above prune to 1 file, and `lower(driver) > 'driver-p'` on a bloom filter index returns all three rows (a probe for `driver-p` would have kept only one file). - `TestDataSkippingStages`: `>` and `<` compile to the max / min check. - Spark 3.5: `TestExpressionIndex` (27), `TestDataSkippingStages` (27), `TestDataSkippingGoldenFilters` pass. ### Documentation Update none ### Contributor's checklist - [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [x] Enough context is provided in the sections above - [x] Adequate tests were added if applicable -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
