-
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 Support for Nested Function Use In WHERE Clause Predicate Expresion #1657
Add Support for Nested Function Use In WHERE Clause Predicate Expresion #1657
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1657 +/- ##
============================================
+ Coverage 97.16% 97.18% +0.01%
- Complexity 4120 4150 +30
============================================
Files 371 372 +1
Lines 10373 10429 +56
Branches 704 716 +12
============================================
+ Hits 10079 10135 +56
Misses 287 287
Partials 7 7
Flags with carried forward coverage won't be shown. Click here to find out more.
|
BuiltinFunctionName.NESTED.name() | ||
)) { | ||
throw new SyntaxCheckException( | ||
"Falling back to legacy engine. Nested function is not supported in the HAVING clause." |
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.
Why? HAVING
implemented the same way as WHERE
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.
Not sure I understand your question, but I implemented the fallback mechanism in AstBuilder
to allow for a fallback specific to the nested function used in the HAVING clause. The old fallback mechanism could not determine between clauses for the filter, and we now support nested in the WHERE clause and not the HAVING so we need to differentiate between nested used in each.
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 think if you remove this check, nested
would be automatically supported in HAVING
, so why not? Less complexity, more functionality.
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.
Good point, may just work as is, though group by is not supported for nested yet. Will need to verify and add tests though, if it fits in the timeline maybe we can support in this release.
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
5dc02e0
to
eb48a0a
Compare
…on (#1657) * Adding support for nested function used in predicate expression. Signed-off-by: forestmvey <forestv@bitquilltech.com> * Add support for LIKE with nested query in predicate expression. Signed-off-by: forestmvey <forestv@bitquilltech.com> --------- Signed-off-by: forestmvey <forestv@bitquilltech.com> (cherry picked from commit 6d796ee)
…on (#1657) * Adding support for nested function used in predicate expression. Signed-off-by: forestmvey <forestv@bitquilltech.com> * Add support for LIKE with nested query in predicate expression. Signed-off-by: forestmvey <forestv@bitquilltech.com> --------- Signed-off-by: forestmvey <forestv@bitquilltech.com> (cherry picked from commit 6d796ee)
…on (#1657) Signed-off-by: forestmvey <forestv@bitquilltech.com>
…on (#1657) Signed-off-by: forestmvey <forestv@bitquilltech.com>
…on (opensearch-project#1657) * Adding support for nested function used in predicate expression. Signed-off-by: forestmvey <forestv@bitquilltech.com> * Add support for LIKE with nested query in predicate expression. Signed-off-by: forestmvey <forestv@bitquilltech.com> --------- Signed-off-by: forestmvey <forestv@bitquilltech.com>
…on (opensearch-project#1657) * Adding support for nested function used in predicate expression. Signed-off-by: forestmvey <forestv@bitquilltech.com> * Add support for LIKE with nested query in predicate expression. Signed-off-by: forestmvey <forestv@bitquilltech.com> --------- Signed-off-by: forestmvey <forestv@bitquilltech.com> Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
…on (opensearch-project#1657) * Adding support for nested function used in predicate expression. Signed-off-by: forestmvey <forestv@bitquilltech.com> * Add support for LIKE with nested query in predicate expression. Signed-off-by: forestmvey <forestv@bitquilltech.com> --------- Signed-off-by: forestmvey <forestv@bitquilltech.com>
Description
Syntax:
nested( [field] | [field,path] )
Add support for use of the nested function in the
WHERE
clause as a predicate expression. Supportsnested
function on left of operator, and literal on right. When usingnested
function inWHERE
clause, the inner hits of the query are not added to thenested
query DSL. To do this you must use thenested
function in conjunction with aSELECT
clause nested function call. See documentation for this nested implementation HERE (WIP).Example Queries
SELECT message.info FROM nested_objects WHERE nested(message.info, message) = 'a';
SELECT nested(message.info) FROM nested_objects WHERE nested(message.info, message) = 'a';
SELECT message.info FROM nested_objects WHERE nested(message.info) = 'a' OR nested(comment.data) = 'b' AND nested(message.dayOfWeek) = 4;
Issues Resolved
Issue: 1111
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.