-
Notifications
You must be signed in to change notification settings - Fork 600
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
feat(expr): Implement IS [NOT] DISTINCT FROM expression #2582
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2582 +/- ##
==========================================
+ Coverage 72.19% 72.37% +0.17%
==========================================
Files 674 678 +4
Lines 87853 88038 +185
==========================================
+ Hits 63422 63714 +292
+ Misses 24431 24324 -107
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
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
src/frontend/src/binder/expr/mod.rs
Outdated
FunctionCall::new_unchecked( | ||
ExprType::Or, | ||
vec![ | ||
FunctionCall::new_unchecked( |
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.
Is there any preference for new_unchecked
over new
or the other way around? @xiangjinwu
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.
As the name and doc suggested, new_unchecked
bypasses type checking and should only be used for a good reason.
Here the innermost expressions (IsNull, IsNotNull, Equal, NotEqual) are using new
correctly, and outer expressions (And, Or) are bypassing the checks because both operands are from validated inner expressions. This is acceptable, but maybe the performance gain is negligible.
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.
Btw each clone of expr means repeated evaluation in the backend. It may be better to implement these 2 operators in backend directly rather than rewriting to such long expressions in the frontend.
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.
I see, let this PR add some tests first to make sure the semantics are all correct.
Then another PR implements the operators in the backend and removes the rewriting.
The expression binding is fixed so that it can now only evaluate to either true or false (instead of unknown). E2E tests were also added. |
What's changed and what's your intention?
IS [NOT] DISTINCT FROM
expression.IsNull
,IsNotNull
,Equals
, andNotEquals
to build a binding with the same truth value asIS NOT DISTINCT FROM
.Checklist
Refer to a related PR or issue link (optional)
#2513