Package org.apache.calcite.sql.advise
Class SqlSimpleParser
java.lang.Object
org.apache.calcite.sql.advise.SqlSimpleParser
A simple parser that takes an incomplete and turn it into a syntactically
correct statement. It is used in the SQL editor user-interface.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Token representing an identifier.static class
Token.static class
Tokenizer. -
Constructor Summary
ConstructorDescriptionSqlSimpleParser
(String hintToken) Deprecated.SqlSimpleParser
(String hintToken, SqlParser.Config parserConfig) Creates a SqlSimpleParser. -
Method Summary
Modifier and TypeMethodDescriptionsimplifySql
(String sql) Turns a partially completed or syntactically incorrect SQL statement into a simplified, valid one that can be validated.simplifySql
(String sql, int cursor) Turns a partially completed or syntactically incorrect sql statement into a simplified, valid one that can be passed into getCompletionHints().
-
Constructor Details
-
SqlSimpleParser
Deprecated.Creates a SqlSimpleParser.- Parameters:
hintToken
- Hint token
-
SqlSimpleParser
Creates a SqlSimpleParser.- Parameters:
hintToken
- Hint tokenparserConfig
- parser configuration
-
-
Method Details
-
simplifySql
Turns a partially completed or syntactically incorrect sql statement into a simplified, valid one that can be passed into getCompletionHints().- Parameters:
sql
- A partial or syntactically incorrect sql statementcursor
- to indicate column position in the query at which completion hints need to be retrieved.- Returns:
- a completed, valid (and possibly simplified SQL statement
-
simplifySql
Turns a partially completed or syntactically incorrect SQL statement into a simplified, valid one that can be validated.- Parameters:
sql
- A partial or syntactically incorrect sql statement- Returns:
- a completed, valid (and possibly simplified) SQL statement
-
SqlSimpleParser(String, SqlParser.Config)