Interface Parser
-
- All Known Implementing Classes:
ParserImpl
@PublicEvolving public interface Parser
Provides methods for parsing SQL objects from a SQL string.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String[]
getCompletionHints(String statement, int position)
Returns completion hints for the given statement at the given cursor position.List<Operation>
parse(String statement)
Entry point for parsing SQL queries expressed as a String.UnresolvedIdentifier
parseIdentifier(String identifier)
Entry point for parsing SQL identifiers expressed as a String.ResolvedExpression
parseSqlExpression(String sqlExpression, RowType inputRowType, LogicalType outputType)
Entry point for parsing SQL expressions expressed as a String.
-
-
-
Method Detail
-
parse
List<Operation> parse(String statement)
Entry point for parsing SQL queries expressed as a String.Note:If the created
Operation
is aQueryOperation
it must be in a form that will be understood by thePlanner.translate(List)
method.The produced Operation trees should already be validated.
- Parameters:
statement
- the SQL statement to evaluate- Returns:
- parsed queries as trees of relational
Operation
s - Throws:
SqlParserException
- when failed to parse the statement
-
parseIdentifier
UnresolvedIdentifier parseIdentifier(String identifier)
Entry point for parsing SQL identifiers expressed as a String.- Parameters:
identifier
- the SQL identifier to parse- Returns:
- parsed identifier
- Throws:
SqlParserException
- when failed to parse the identifier
-
parseSqlExpression
ResolvedExpression parseSqlExpression(String sqlExpression, RowType inputRowType, @Nullable LogicalType outputType)
Entry point for parsing SQL expressions expressed as a String.- Parameters:
sqlExpression
- the SQL expression to parseinputRowType
- the fields available in the SQL expressionoutputType
- expected top-level output type if available- Returns:
- resolved expression
- Throws:
SqlParserException
- when failed to parse the sql expression
-
getCompletionHints
String[] getCompletionHints(String statement, int position)
Returns completion hints for the given statement at the given cursor position. The completion happens case insensitively.- Parameters:
statement
- Partial or slightly incorrect SQL statementposition
- cursor position- Returns:
- completion hints that fit at the current cursor position
-
-