Skip to content
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

Ppl help command #685

Closed
wants to merge 23 commits into from
Closed

Conversation

YANG-DB
Copy link
Member

@YANG-DB YANG-DB commented Sep 20, 2024

Description

Add PPL -help command to assist grammar explaining and assisting users on different dialects and semantic

search -help

results in:

SEARCH Command:

Syntax:
   (SEARCH)? fromClause
   | (SEARCH)? fromClause logicalExpression
   | (SEARCH)? logicalExpression fromClause

Description:
The SEARCH command is used to retrieve data from a specified source. It can be used with or without additional filters.
- You can specify the data source using the FROM clause.
- You can add filters using logical expressions.
- The order of FROM clause and logical expression can be interchanged.

Issues Resolved

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.

@YANG-DB YANG-DB added the Lang:PPL Pipe Processing Language support label Sep 20, 2024
@YANG-DB YANG-DB marked this pull request as draft September 20, 2024 00:19
@YANG-DB
Copy link
Member Author

YANG-DB commented Sep 20, 2024

@LantaoJin
I would appreciate your feedback on the approach i've drafter here for adding help parameter attribute for each command, for example the following would provide information and examples for the search command:

search -help

This would be done for all commands we want to add the help description to.

Implementation concepts and consideration

  • Added a dedicated AstCommandDescriptionVisitor which is an additional visitor (to the ASTBuilder ) that is only responsible of the commands decoration visiting.
  • The result is that AstStatementBuilder now hold a chain of visitors that run on each query and produce a plan (or not if they dont apply)
  • FlintPPLSparkExtensions was added with injectPlannerStrategy to override the standard queries in case of a PrintLiteralCommandDescriptionLogicalPlan plan and to avoid reaching to the underlying SQL engine and responding with the actual planner's text that was generated during the former stage

Please let me know if this sounds reasonable and if you have any suggestions to make this simpler
Thanks

@LantaoJin
Copy link
Member

LantaoJin commented Sep 20, 2024

Hi @YANG-DB , I haven't get the point what is the help command for.

The result is that AstStatementBuilder now hold a chain of visitors that run on each query and produce a plan (or not if they dont apply)

Seems you are going to add a debug or explain command to display the translated Spark unresolved plan tree. help sounds like a customer towards command to show usage of PPL.

If your proposal is for debug or explain purpose, I think the display info not only includes the unresolved plan, but also the physical plan (which will reach to the underlying SQL engine) with a trigger.

What confused me is the usage in description. It definitely is a help command. Beside the syntax, we can add some usage or examples.

For the debug or explain command, we need to display a generated plan for the PPL query user provided.

SEARCH explain=index
| <ppl command1>
| <ppl command2

or

EXPLAIN source=index
| <ppl command1>
| <ppl command2

@YANG-DB YANG-DB added the 0.6 label Sep 25, 2024
# Conflicts:
#	ppl-spark-integration/src/main/java/org/opensearch/sql/ppl/CatalystQueryPlanVisitor.java
#	ppl-spark-integration/src/main/java/org/opensearch/sql/ppl/parser/AstStatementBuilder.java
#	ppl-spark-integration/src/main/scala/org/opensearch/flint/spark/ppl/PPLSyntaxParser.scala
Signed-off-by: YANGDB <[email protected]>
@YANG-DB
Copy link
Member Author

YANG-DB commented Sep 30, 2024

@YANG-DB plz resolve conflict

@YANG-DB
Copy link
Member Author

YANG-DB commented Nov 14, 2024

closing this as it has not gained sufficient attention

@YANG-DB YANG-DB closed this Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.6 Lang:PPL Pipe Processing Language support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants