Interface Parser


@PublicEvolving public interface Parser
Provides methods for parsing SQL objects from a SQL string.
  • Method Summary

    Modifier and Type
    Method
    Description
    getCompletionHints(String statement, int position)
    Returns completion hints for the given statement at the given cursor position.
    parse(String statement)
    Entry point for parsing SQL queries expressed as a String.
    org.apache.flink.table.catalog.UnresolvedIdentifier
    parseIdentifier(String identifier)
    Entry point for parsing SQL identifiers expressed as a String.
    org.apache.flink.table.expressions.ResolvedExpression
    parseSqlExpression(String sqlExpression, org.apache.flink.table.types.logical.RowType inputRowType, org.apache.flink.table.types.logical.LogicalType outputType)
    Entry point for parsing SQL expressions expressed as a String.
  • Method Details

    • parse

      List<Operation> parse(String statement)
      Entry point for parsing SQL queries expressed as a String.

      Note:If the created Operation is a QueryOperation it must be in a form that will be understood by the Planner.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 Operations
      Throws:
      SqlParserException - when failed to parse the statement
    • parseIdentifier

      org.apache.flink.table.catalog.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

      org.apache.flink.table.expressions.ResolvedExpression parseSqlExpression(String sqlExpression, org.apache.flink.table.types.logical.RowType inputRowType, @Nullable org.apache.flink.table.types.logical.LogicalType outputType)
      Entry point for parsing SQL expressions expressed as a String.
      Parameters:
      sqlExpression - the SQL expression to parse
      inputRowType - the fields available in the SQL expression
      outputType - 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 statement
      position - cursor position
      Returns:
      completion hints that fit at the current cursor position