-
Notifications
You must be signed in to change notification settings - Fork 33
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
#963 Unimplemented PPL Sort Syntax #994
#963 Unimplemented PPL Sort Syntax #994
Conversation
b44dad7
to
0e03dd8
Compare
I don't think the sort syntax is |
Thanks @LantaoJin. Agree that "unimplemented" is more accurate. Please also see the discussion on the equivalent SQL issue. The consensus there seems to be to keep this syntax for the time being, update all the documentation to indicate that this syntax is deprecated, and remove it completely in the next major release. As such, I will be updating this PR to merely mark the syntax as deprecated. |
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
473f0c3
to
a5f35bc
Compare
Signed-off-by: currantw <[email protected]>
ppl-spark-integration/src/main/java/org/opensearch/sql/ppl/parser/AstExpressionBuilder.java
Outdated
Show resolved
Hide resolved
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.
mostly good - just one question about this part:
Compare lengthEqualsZero = new Compare(EQUAL.getName().getFunctionName(), lengthFunction, new Literal(0, DataType.INTEGER));
This doesn't resolve #963 - but just deprecates the unimplemented language. |
ppl-spark-integration/src/main/java/org/opensearch/sql/ppl/parser/AstExpressionBuilder.java
Outdated
Show resolved
Hide resolved
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Based on the conversation here, it seems like consensus is that we should implement the PPL sort syntax, rather than deprecate and remove it. As such, I have changed this PR to simply mark it as "unimplemented" so that users don't unwittingly use it. |
@@ -122,41 +123,47 @@ class PPLLogicalPlanParseTranslatorTestSuite | |||
|
|||
test("test parse email & host expressions including cast and sort commands") { |
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.
@currantw plz add the corresponding IT (place holder ?) for a concrete index:
val query =
"source=t" +
" | parse address '(?<streetNumber>\\d+) (?<street>.+)'" +
" | eval streetNumberInt = cast(streetNumber as integer)" +
" | where streetNumberInt > 500" +
" | sort streetNumberInt" +
" | fields streetNumber, street"
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
@currantw LGTM ...
|
@@ -274,7 +274,8 @@ source = table | where ispresent(a) | | |||
- `source=accounts | parse email '.+@(?<host>.+)' | stats count() by host` | |||
- `source=accounts | parse email '.+@(?<host>.+)' | eval eval_result=1 | fields host, eval_result` | |||
- `source=accounts | parse email '.+@(?<host>.+)' | where age > 45 | sort - age | fields age, email, host` | |||
- `source=accounts | parse address '(?<streetNumber>\d+) (?<street>.+)' | where streetNumber > 500 | sort num(streetNumber) | fields streetNumber, street` | |||
- `source=accounts | parse address '(?<streetNumber>\d+) (?<street>.+)' | eval streetNumberInt = cast(streetNumber as integer) | where streetNumberInt > 500 | sort streetNumberInt | fields streetNumber, street` | |||
- **Note**: The `sort num` syntax is not implemented. To sort numerically, cast to a numerical data type - e.g. `sort cast(streetNumber as integer)`. See [#963](https://github.com/opensearch-project/opensearch-spark/issues/963) for more details. |
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.
- **Note**: The `sort num` syntax is not implemented. To sort numerically, cast to a numerical data type - e.g. `sort cast(streetNumber as integer)`. See [#963](https://github.com/opensearch-project/opensearch-spark/issues/963) for more details. | |
- **Note**: The `sort num` syntax is not implemented. See [#963](https://github.com/opensearch-project/opensearch-spark/issues/963) for more details. |
docs/ppl-lang/ppl-parse-command.md
Outdated
@@ -68,6 +68,8 @@ PPL query: | |||
| 880 | Holmes Lane | | |||
+----------------+----------------+ | |||
|
|||
**Note**: The `sort num` syntax is not implemented. To sort numerically, cast to a numerical data type - e.g. `sort cast(streetNumber as integer)`. See [#963](https://github.com/opensearch-project/opensearch-spark/issues/963) for more details. |
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.
Someone in the future may get confused by this comment since the sort num
syntax is no longer mentioned here.
I'd suggest removing the node completely.
@currantw plz check why build is failing |
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Description
Updates documentation to mark PPL sort syntax (e.g.
sort num
) as unimplemented.Temporary measure related to #963, where the consensus seems to be that this syntax should eventually be supported.
Related Issues
OpenSearch SQL issue: opensearch-project/sql#3180
Check List
Implemented unit testsImplemented tests for combination with other commandsNew added source code should include a copyright header--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.