-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite BETWEEN to >= AND <= for SV columns in the v1 query engine #14111
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14111 +/- ##
============================================
+ Coverage 61.75% 64.04% +2.29%
- Complexity 207 1538 +1331
============================================
Files 2436 2597 +161
Lines 133233 143376 +10143
Branches 20636 21962 +1326
============================================
+ Hits 82274 91832 +9558
+ Misses 44911 44783 -128
- Partials 6048 6761 +713
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
deff3cc
to
762605f
Compare
I'm a little bit confused here. Why can't we rewrite |
The current logic in |
I'm thinking to use the existing logic in |
Makes sense, I'm closing this PR since it's superseded by #14163. I'll raise a small separate PR with the tests for |
PredicateComparisonRewriter
since that would fix at least two issues with theBETWEEN
filter predicate -WHERE intCol BETWEEN 1.5 AND 2.5
currently doesn't work (since theNumericalFilterOptimizer
is not applied toBETWEEN
) andWHERE col1 BETWEEN col2 AND col3
also doesn't work (since Pinot's v1 query engine only supports filter predicates with literals as operands other than the LHS column identifier).FilterOptimizer
since the optimizers do have access to the schema. However, this won't be able to solve theWHERE col1 BETWEEN col2 AND col3
kind of use case since that re-write is only applied to supported filter predicates inPredicateComparisonRewriter
which happens before the optimizers are applied.col1 BETWEEN col2 AND col3
withcol1 - col2 >= 0 AND col1 - col3 <= 0
) since the assumption that filter predicates only have literals in all operands (other than the LHS column identifier) is baked into multiple other places - see here, here for instance.NumericalFilterOptimizer
without reducing theBETWEEN
sinceintCol BETWEEN 5.5 AND 10.5
/intCol >= 5.5 AND intCol <= 10.5
/intCol > 5 AND intCol <= 10
are not equivalent tointCol BETWEEN 5 AND 10
(which would beintCol >=5 AND intCol <= 10
).