Add Support for Nested Function in Order By Clause by forestmvey · Pull Request #1789 · opensearch-project/sql · GitHub
Skip to content

Add Support for Nested Function in Order By Clause#1789

Merged
forestmvey merged 2 commits into
opensearch-project:mainfrom
Bit-Quill:integ-nested-order-by
Jun 27, 2023
Merged

Add Support for Nested Function in Order By Clause#1789
forestmvey merged 2 commits into
opensearch-project:mainfrom
Bit-Quill:integ-nested-order-by

Conversation

@forestmvey

Copy link
Copy Markdown
Collaborator

Description

Add support for nested function use in the ORDER BY clause.

Example Queries

SELECT nested(message.info) from nested_objects ORDER BY nested(message.info);

Issues Resolved

Portion of Issue: 1111
Note this does not resolve issue 1777 but only bring V2 engine to parity with V1 engine.

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

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.

* Adding order by clause support for nested function.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Adding test coverage for nested in ORDER BY clause.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Added nested function validation to NestedAnalyzer.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

---------

Signed-off-by: forestmvey <forestv@bitquilltech.com>
@forestmvey forestmvey force-pushed the integ-nested-order-by branch from 554b55f to 84fab78 Compare June 27, 2023 15:33
@codecov

codecov Bot commented Jun 27, 2023

Copy link
Copy Markdown

acarbonetto
acarbonetto previously approved these changes Jun 27, 2023

@acarbonetto acarbonetto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add another check for empty nested call if that's possible.
Otherwise, we should add a parser test/check that fails to parse

* @param nestedFunc Nested function expression.
*/
private void validateNestedArgs(FunctionExpression nestedFunc) {
if (nestedFunc.getArguments().size() > 2) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we also need to check for size() < 1?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I'll add this check and a relevant test too.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to add a test case to validate that nested() returns an IllegalArgumentException?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already have one here

Yury-Fridlyand
Yury-Fridlyand previously approved these changes Jun 27, 2023
GumpacG
GumpacG previously approved these changes Jun 27, 2023
Signed-off-by: forestmvey <forestv@bitquilltech.com>
@forestmvey forestmvey dismissed stale reviews from GumpacG, Yury-Fridlyand, and acarbonetto via de77277 June 27, 2023 18:32
@forestmvey forestmvey merged commit 3302ec8 into opensearch-project:main Jun 27, 2023
opensearch-trigger-bot Bot pushed a commit that referenced this pull request Jun 27, 2023
* Add Support for Nested Function in Order By Clause (#280)

* Adding order by clause support for nested function.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Adding test coverage for nested in ORDER BY clause.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Added nested function validation to NestedAnalyzer.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

---------

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Adding semantic check for missing arguments in function and unit test.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

---------

Signed-off-by: forestmvey <forestv@bitquilltech.com>
(cherry picked from commit 3302ec8)
forestmvey added a commit that referenced this pull request Jun 27, 2023
* Add Support for Nested Function in Order By Clause (#280)

* Adding order by clause support for nested function.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Adding test coverage for nested in ORDER BY clause.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Added nested function validation to NestedAnalyzer.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

---------

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Adding semantic check for missing arguments in function and unit test.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

---------

Signed-off-by: forestmvey <forestv@bitquilltech.com>
(cherry picked from commit 3302ec8)
@forestmvey forestmvey deleted the integ-nested-order-by branch June 27, 2023 22:31
forestmvey added a commit that referenced this pull request Jun 28, 2023
* Add Support for Nested Function in Order By Clause (#280)

* Adding order by clause support for nested function.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Adding test coverage for nested in ORDER BY clause.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Added nested function validation to NestedAnalyzer.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

---------

Signed-off-by: forestmvey <forestv@bitquilltech.com>

* Adding semantic check for missing arguments in function and unit test.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

---------

Signed-off-by: forestmvey <forestv@bitquilltech.com>
(cherry picked from commit 3302ec8)

Co-authored-by: Forest Vey <forestv@bitquilltech.com>
@acarbonetto acarbonetto added the v2.9.0 v2.9.0 label Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants