-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Support conjugates for scalar functions, add more scalar functions #8582
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
Support conjugates for scalar functions, add more scalar functions #8582
Conversation
be23f26 to
73d8d3d
Compare
|
GH issue: #8488 |
Codecov Report
@@ Coverage Diff @@
## master #8582 +/- ##
============================================
- Coverage 70.59% 68.92% -1.68%
- Complexity 4412 4413 +1
============================================
Files 1667 1669 +2
Lines 87314 87365 +51
Branches 13085 13098 +13
============================================
- Hits 61643 60218 -1425
- Misses 21411 22962 +1551
+ Partials 4260 4185 -75
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
eefad9f to
7a5fff1
Compare
Jackie-Jiang
left a comment
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.
This approach is better than #8563
Could you please add some description to the PR? Don't put the template as the description as that doesn't help reviewers understand the purpose of the PR
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.
(minor) Revert this file
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.
Ack
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.
Suggest adding 3 execution nodes: AndExecutionNode, OrExecutionNode, NotExecutionNode. IMO no need to add the concept of ConjugateFunction
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.
Ack
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.
User will mostly likely use the function name within the FilterKind, and we should include that in the alias
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.
Ack
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 svInt = 123 AND svInt < 123 work? Users usually don't use eq or lte explicitly.
Also let's put some filter that can potentially match record to test the behavior
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 was LTE. Hence it worked :)
Had added these to be able to test and / or. Made the tests a bit more extensive.
All the filters actually match the record. SKIP_RECORD_KEY is being checked for.
612bcd7 to
e1c216e
Compare
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.
These 2 methods need to be annotated with nullableParameters = true
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.
Ack
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.
(nit) Redundant parenthesis, same for others
| Boolean res = (Boolean) (executableNode.execute(row)); | |
| Boolean res = (Boolean) executableNode.execute(row); |
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.
We don't need to annotate the names because it matches the method name in the canonical format
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 wonder if users will use gt instead of >, and IIRC gt is not standard SQL syntax. We may just make the method name match the filter kind in camel case (they will be canonicalized to the same name)
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.
Ack
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.
Let's change the expression to svInt = 123 AND svDouble <= 200. Users won't explicitly write query in this format
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.
ack
d48c94a to
70aae26
Compare
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.
need to make sure these work case-insensitive way (all other scalar functions do)
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.
Jackie-Jiang
left a comment
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, only minor/nit comments
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.
(minor)
| Preconditions.checkState(numArguments == 1, "Unsupported number of arguments for NOT operator"); | |
| Preconditions.checkState(numArguments == 1, "NOT function expects 1 argument, got: %s", numArguments); |
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.
Ack
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.
(nit)
| return (Math.abs(a - b) >= DOUBLE_COMPARISON_TOLERANCE); | |
| return Math.abs(a - b) >= DOUBLE_COMPARISON_TOLERANCE; |
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.
Ack
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.
(nit)
| return (Math.abs(a - b) < DOUBLE_COMPARISON_TOLERANCE); | |
| return Math.abs(a - b) < DOUBLE_COMPARISON_TOLERANCE; |
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.
Ack
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.
(nit)
| return (val > a) && (val < b); | |
| return val > a && val < b; |
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.
Ack
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.
(minor)
| public static boolean isNull(Object obj) { | |
| public static boolean isNull(@Nullable Object obj) { |
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.
Ack
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.
(minor)
| public static boolean isNotNull(Object obj) { | |
| public static boolean isNotNull(@Nullable Object obj) { |
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.
Ack
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.
this shouldn't work rt? it should be svInt == 123
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.
In SQL, we use = for comparison, e.g. SELECT * FROM myTable WHERE svInt = 123
ed6183a to
60d4227
Compare
60d4227 to
58739e4
Compare
This PR adds support for being able to use complex scalar function expressions for fitlterConfig. In addition to common comparison functions, support for AND, OR and NOT has been added.
GH issue: #8488
How to use
With this change, filterConfig's filterFunction can now be simple SQL like expressions. This simplifies filtering of records especially with Groovy expressions being disabled by default.