Interface SqlValidatorWithHints

All Superinterfaces:
All Known Implementing Classes:
CalciteSqlValidator, ContextSqlValidator, SqlAdvisorValidator, SqlValidatorImpl

public interface SqlValidatorWithHints extends SqlValidator
Extends SqlValidator to allow discovery of useful data such as fully qualified names of SQL objects, alternative valid SQL objects that can be used in the SQL statement (dubbed as hints).
  • Method Details

    • lookupHints

      List<SqlMoniker> lookupHints(SqlNode topNode, SqlParserPos pos)
      Looks up completion hints for a syntactically correct SQL statement that has been parsed into an expression tree. (Note this should be called after SqlValidator.validate(org.apache.calcite.sql.SqlNode).
      topNode - top of expression tree in which to lookup completion hints
      pos - indicates the position in the sql statement we want to get completion hints for. For example, "select a.ename, b.deptno from sales.emp a join sales.dept b "on a.deptno=b.deptno where empno=1"; setting pos to 'Line 1, Column 17' returns all the possible column names that can be selected from sales.dept table setting pos to 'Line 1, Column 31' returns all the possible table names in 'sales' schema
      an array of SqlMoniker (sql identifiers) that can fill in at the indicated position
    • lookupQualifiedName

      @Nullable SqlMoniker lookupQualifiedName(SqlNode topNode, SqlParserPos pos)
      Looks up the fully qualified name for a SqlIdentifier at a given Parser Position in a parsed expression tree Note: call this only after SqlValidator.validate(org.apache.calcite.sql.SqlNode) has been called.
      topNode - top of expression tree in which to lookup the qualified name for the SqlIdentifier
      pos - indicates the position of the SqlIdentifier in the SQL statement we want to get the qualified name for
      a string of the fully qualified name of the SqlIdentifier if the Parser position represents a valid SqlIdentifier. Else return null