-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add BETWEEN expression in v2 engine #1163
Add BETWEEN expression in v2 engine #1163
Conversation
Signed-off-by: Chen Dai <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 2.x #1163 +/- ##
============================================
- Coverage 98.31% 95.81% -2.50%
- Complexity 3521 3524 +3
============================================
Files 342 352 +10
Lines 8700 9371 +671
Branches 554 674 +120
============================================
+ Hits 8553 8979 +426
- Misses 142 334 +192
- Partials 5 58 +53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Chen Dai <[email protected]>
Signed-off-by: Chen Dai <[email protected]>
Signed-off-by: Chen Dai <[email protected]>
Signed-off-by: Chen Dai <[email protected]>
Signed-off-by: Chen Dai <[email protected]>
Signed-off-by: Chen Dai <[email protected]>
Signed-off-by: Chen Dai <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does PPL have BETWEEN? Should it? Why not?
It is interesting how it works with Bit-Quill#129, e.g.
SELECT DATE('2022-11-22') BETWEEN DATETIME('1984-02-01 10:20:30') AND NOW()
Thanks for pointing this out! I did a quick check earlier but couldn't find anything in SPL. Please let me know if you're aware. Yeah, I think it will be much more convenient for users with more complete function and type cast. :) |
It works, I merged branches and run a test:
I can't find it in SPL too, but we can add it to PPL regardless of that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @dai-chen!
Should this be merged to 2.x branch or main now?
Yes, because this PR was raised during the transition, I've added |
* Add between grammar and in-memory impl Signed-off-by: Chen Dai <[email protected]> * Add comparison test for between Signed-off-by: Chen Dai <[email protected]> * Add doctest for between Signed-off-by: Chen Dai <[email protected]> * Add not between support Signed-off-by: Chen Dai <[email protected]> * Fix doctest failure Signed-off-by: Chen Dai <[email protected]> * Refactor to rewrite to basic comparison expression Signed-off-by: Chen Dai <[email protected]> * Clean up unused code Signed-off-by: Chen Dai <[email protected]> * Prepare to publish PR Signed-off-by: Chen Dai <[email protected]> Signed-off-by: Chen Dai <[email protected]> (cherry picked from commit 6c0af83)
* Add between grammar and in-memory impl Signed-off-by: Chen Dai <[email protected]> * Add comparison test for between Signed-off-by: Chen Dai <[email protected]> * Add doctest for between Signed-off-by: Chen Dai <[email protected]> * Add not between support Signed-off-by: Chen Dai <[email protected]> * Fix doctest failure Signed-off-by: Chen Dai <[email protected]> * Refactor to rewrite to basic comparison expression Signed-off-by: Chen Dai <[email protected]> * Clean up unused code Signed-off-by: Chen Dai <[email protected]> * Prepare to publish PR Signed-off-by: Chen Dai <[email protected]> Signed-off-by: Chen Dai <[email protected]> (cherry picked from commit 6c0af83) Co-authored-by: Chen Dai <[email protected]>
Signed-off-by: Chen Dai [email protected]
Description
Support
BETWEEN
andNOT BETWEEN
expression in v2 engine to avoid fallback to legacy code.Between
AST node and wrap it byNot
node in the case ofNOT BETWEEN
.Between
node to basic comparison predicate. Specifically, rewriteA BETWEEN X AND Y
toX <= A AND A <= Y
.Benefits of the implementation:
between
andnot_between
BETWEEN boolean AND boolean
is not a valid signature. The current implementation delegate this toLTE
andGTE
function signature.age <= 50 AND age BETWEEN 10 AND 60
.This approach maybe applied to other functions:
NOT NULL
,NOT LIKE
etc.Issues Resolved
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.