Class DrillParserImpl

java.lang.Object
org.apache.calcite.sql.parser.SqlAbstractParserImpl
org.apache.drill.exec.planner.sql.parser.impl.DrillParserImpl
All Implemented Interfaces:
DrillParserImplConstants
Direct Known Subclasses:
DrillParserWithCompoundIdConverter

public class DrillParserImpl extends org.apache.calcite.sql.parser.SqlAbstractParserImpl implements DrillParserImplConstants
SQL parser, generated from Parser.jj by JavaCC.

The public wrapper for this parser is SqlParser.

  • Field Details

    • FACTORY

      public static final org.apache.calcite.sql.parser.SqlParserImplFactory FACTORY
      SqlParserImplFactory implementation for creating parser.
    • token_source

      public DrillParserImplTokenManager token_source
      Generated Token Manager.
    • token

      public Token token
      Current token.
    • jj_nt

      public Token jj_nt
      Next token.
  • Constructor Details

    • DrillParserImpl

      public DrillParserImpl(InputStream stream)
      Constructor with InputStream.
    • DrillParserImpl

      public DrillParserImpl(InputStream stream, String encoding)
      Constructor with InputStream and supplied encoding
    • DrillParserImpl

      public DrillParserImpl(Reader stream)
      Constructor.
    • DrillParserImpl

      public DrillParserImpl(DrillParserImplTokenManager tm)
      Constructor with generated Token Manager.
  • Method Details

    • normalizeException

      public org.apache.calcite.sql.parser.SqlParseException normalizeException(Throwable ex)
      Specified by:
      normalizeException in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
    • getMetadata

      public org.apache.calcite.sql.parser.SqlAbstractParserImpl.Metadata getMetadata()
      Specified by:
      getMetadata in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
    • setTabSize

      public void setTabSize(int tabSize)
      Specified by:
      setTabSize in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
    • switchTo

      public void switchTo(org.apache.calcite.sql.parser.SqlAbstractParserImpl.LexicalState state)
      Specified by:
      switchTo in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
    • setQuotedCasing

      public void setQuotedCasing(org.apache.calcite.avatica.util.Casing quotedCasing)
      Specified by:
      setQuotedCasing in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
    • setUnquotedCasing

      public void setUnquotedCasing(org.apache.calcite.avatica.util.Casing unquotedCasing)
      Specified by:
      setUnquotedCasing in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
    • setIdentifierMaxLength

      public void setIdentifierMaxLength(int identifierMaxLength)
      Specified by:
      setIdentifierMaxLength in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
    • setConformance

      public void setConformance(org.apache.calcite.sql.validate.SqlConformance conformance)
      Specified by:
      setConformance in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
    • parseSqlExpressionEof

      public org.apache.calcite.sql.SqlNode parseSqlExpressionEof() throws Exception
      Specified by:
      parseSqlExpressionEof in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
      Throws:
      Exception
    • parseSqlStmtEof

      public org.apache.calcite.sql.SqlNode parseSqlStmtEof() throws Exception
      Specified by:
      parseSqlStmtEof in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
      Throws:
      Exception
    • parseSqlStmtList

      public org.apache.calcite.sql.SqlNodeList parseSqlStmtList() throws Exception
      Specified by:
      parseSqlStmtList in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
      Throws:
      Exception
    • parseArray

      public org.apache.calcite.sql.SqlNode parseArray() throws org.apache.calcite.sql.parser.SqlParseException
      Specified by:
      parseArray in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
      Throws:
      org.apache.calcite.sql.parser.SqlParseException
    • ExtendedTableRef

      public final org.apache.calcite.sql.SqlNode ExtendedTableRef() throws ParseException
      Allows parser to be extended with new types of table references. The default implementation of this production is empty.
      Throws:
      ParseException
    • TableOverOpt

      public final org.apache.calcite.sql.SqlNode TableOverOpt() throws ParseException
      Allows an OVER clause following a table expression as an extension to standard SQL syntax. The default implementation of this production is empty.
      Throws:
      ParseException
    • SqlSelectKeywords

      public final void SqlSelectKeywords(List<org.apache.calcite.sql.SqlLiteral> keywords) throws ParseException
      Throws:
      ParseException
    • SqlInsertKeywords

      public final void SqlInsertKeywords(List<org.apache.calcite.sql.SqlLiteral> keywords) throws ParseException
      Throws:
      ParseException
    • FloorCeilOptions

      public final org.apache.calcite.sql.SqlNode FloorCeilOptions(org.apache.calcite.sql.parser.Span s, boolean floorFlag) throws ParseException
      Throws:
      ParseException
    • getPos

      protected org.apache.calcite.sql.parser.SqlParserPos getPos() throws ParseException
      Specified by:
      getPos in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
      Throws:
      ParseException
    • ExprOrJoinOrOrderedQuery

      public final org.apache.calcite.sql.SqlNode ExprOrJoinOrOrderedQuery(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Syntactical Descriptions *
      Throws:
      ParseException
    • OrderedQueryOrExpr

      public final org.apache.calcite.sql.SqlNode OrderedQueryOrExpr(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses either a row expression or a query expression with an optional ORDER BY.

      Postgres syntax for limit:

          [ LIMIT { count | ALL } ]
          [ OFFSET start ]

      Trino syntax for limit:

          [ OFFSET start ]
          [ LIMIT { count | ALL } ]

      MySQL syntax for limit:

          [ LIMIT { count | start, count } ]

      SQL:2008 syntax for limit:

          [ OFFSET start { ROW | ROWS } ]
          [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
      Throws:
      ParseException
    • OrderByLimitOpt

      public final org.apache.calcite.sql.SqlNode OrderByLimitOpt(org.apache.calcite.sql.SqlNode e) throws ParseException
      Reads optional "ORDER BY", "LIMIT", "OFFSET", "FETCH" following a query, e. If any of them are present, adds them to the query; otherwise returns the query unchanged. Throws if they are present and e is not a query.
      Throws:
      ParseException
    • OffsetClause

      public final void OffsetClause(org.apache.calcite.sql.parser.Span s, org.apache.calcite.sql.SqlNode[] offsetFetch) throws ParseException
      Parses an OFFSET clause in an ORDER BY expression.
      Throws:
      ParseException
    • FetchClause

      public final void FetchClause(org.apache.calcite.sql.SqlNode[] offsetFetch) throws ParseException
      Parses a FETCH clause in an ORDER BY expression.
      Throws:
      ParseException
    • LimitClause

      public final void LimitClause(org.apache.calcite.sql.parser.Span s, org.apache.calcite.sql.SqlNode[] offsetFetch) throws ParseException
      Parses a LIMIT clause in an ORDER BY expression.
      Throws:
      ParseException
    • LeafQuery

      public final org.apache.calcite.sql.SqlNode LeafQuery(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a leaf in a query expression (SELECT, VALUES or TABLE).
      Throws:
      ParseException
    • ParenthesizedExpression

      public final org.apache.calcite.sql.SqlNode ParenthesizedExpression(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a parenthesized query or single row expression. Depending on exprContext, may also accept a join.
      Throws:
      ParseException
    • ParenthesizedQueryOrCommaList

      public final org.apache.calcite.sql.SqlNodeList ParenthesizedQueryOrCommaList(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a parenthesized query or comma-list of row expressions.

      REVIEW jvs 8-Feb-2004: There's a small hole in this production. It can be used to construct something like

       WHERE x IN (select count(*) from t where c=d,5)

      which should be illegal. The above is interpreted as equivalent to

       WHERE x IN ((select count(*) from t where c=d),5)

      which is a legal use of a sub-query. The only way to fix the hole is to be able to remember whether a subexpression was parenthesized or not, which means preserving parentheses in the SqlNode tree. This is probably desirable anyway for use in purely syntactic parsing applications (e.g. SQL pretty-printer). However, if this is done, it's important to also make isA() on the paren node call down to its operand so that we can always correctly discriminate a query from a row expression.

      Throws:
      ParseException
    • ParenthesizedQueryOrCommaListWithDefault

      public final org.apache.calcite.sql.SqlNodeList ParenthesizedQueryOrCommaListWithDefault(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      As ParenthesizedQueryOrCommaList, but allows DEFAULT in place of any of the expressions. For example, (x, DEFAULT, null, DEFAULT).
      Throws:
      ParseException
    • UnquantifiedFunctionParameterList

      public final List<org.apache.calcite.sql.SqlNode> UnquantifiedFunctionParameterList(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses function parameter lists. If the list starts with DISTINCT or ALL, it is discarded.
      Throws:
      ParseException
    • FunctionParameterList

      public final List<org.apache.calcite.sql.SqlNode> FunctionParameterList(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses function parameter lists including DISTINCT keyword recognition, DEFAULT, and named argument assignment.
      Throws:
      ParseException
    • AllOrDistinct

      public final org.apache.calcite.sql.SqlLiteral AllOrDistinct() throws ParseException
      Throws:
      ParseException
    • AddArg0

      public final void AddArg0(List<org.apache.calcite.sql.SqlNode> list, org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Throws:
      ParseException
    • AddArg

      public final void AddArg(List<org.apache.calcite.sql.SqlNode> list, org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Throws:
      ParseException
    • Default

      public final org.apache.calcite.sql.SqlNode Default() throws ParseException
      Throws:
      ParseException
    • SqlQueryEof

      public final org.apache.calcite.sql.SqlNode SqlQueryEof() throws ParseException
      Parses a query (SELECT, UNION, INTERSECT, EXCEPT, VALUES, TABLE) followed by the end-of-file symbol.
      Throws:
      ParseException
    • SqlStmtList

      public final org.apache.calcite.sql.SqlNodeList SqlStmtList() throws ParseException
      Parses a list of SQL statements separated by semicolon. The semicolon is required between statements, but is optional at the end.
      Throws:
      ParseException
    • SqlStmt

      public final org.apache.calcite.sql.SqlNode SqlStmt() throws ParseException
      Parses an SQL statement.
      Throws:
      ParseException
    • SqlStmtEof

      public final org.apache.calcite.sql.SqlNode SqlStmtEof() throws ParseException
      Parses an SQL statement followed by the end-of-file symbol.
      Throws:
      ParseException
    • SqlShowTables

      public final org.apache.calcite.sql.SqlNode SqlShowTables() throws ParseException
      Parses statement SHOW TABLES [{FROM | IN} db_name] [LIKE 'pattern' | WHERE expr]
      Throws:
      ParseException
    • SqlShowFiles

      public final org.apache.calcite.sql.SqlNode SqlShowFiles() throws ParseException
      Parses statement SHOW FILES [{FROM | IN} schema]
      Throws:
      ParseException
    • SqlShowSchemas

      public final org.apache.calcite.sql.SqlNode SqlShowSchemas() throws ParseException
      Parses statement SHOW {DATABASES | SCHEMAS} [LIKE 'pattern' | WHERE expr]
      Throws:
      ParseException
    • SqlDescribeTable

      public final org.apache.calcite.sql.SqlNode SqlDescribeTable() throws ParseException
      Parses statement { DESCRIBE | DESC } [TABLE] tblname [col_name | wildcard ]
      Throws:
      ParseException
    • SqlUseSchema

      public final org.apache.calcite.sql.SqlNode SqlUseSchema() throws ParseException
      Throws:
      ParseException
    • ParseOptionalFieldList

      public final org.apache.calcite.sql.SqlNodeList ParseOptionalFieldList(String relType) throws ParseException
      Parses an optional field list and makes sure no field is a "*".
      Throws:
      ParseException
    • ParseRequiredFieldList

      public final org.apache.calcite.sql.SqlNodeList ParseRequiredFieldList(String relType) throws ParseException
      Parses a required field list and makes sure no field is a "*".
      Throws:
      ParseException
    • SqlCreateOrReplace

      public final org.apache.calcite.sql.SqlNode SqlCreateOrReplace() throws ParseException
      Parses CREATE [OR REPLACE] command for VIEW, TABLE or SCHEMA.
      Throws:
      ParseException
    • SqlCreateView

      public final org.apache.calcite.sql.SqlNode SqlCreateView(org.apache.calcite.sql.parser.SqlParserPos pos, String createType) throws ParseException
      Parses a create view or replace existing view statement. after CREATE OR REPLACE VIEW statement which is handled in the SqlCreateOrReplace method. CREATE { [OR REPLACE] VIEW | VIEW [IF NOT EXISTS] | VIEW } view_name [ (field1, field2 ...) ] AS select_statement
      Throws:
      ParseException
    • SqlCreateTable

      public final org.apache.calcite.sql.SqlNode SqlCreateTable(org.apache.calcite.sql.parser.SqlParserPos pos, boolean isTemporary) throws ParseException
      Parses a CTAS or CTTAS statement after CREATE [TEMPORARY] TABLE statement which is handled in the SqlCreateOrReplace method. CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tblname [ (field1, field2, ...) ] AS select_statement.
      Throws:
      ParseException
    • SqlCreateSchema

      public final org.apache.calcite.sql.SqlNode SqlCreateSchema(org.apache.calcite.sql.parser.SqlParserPos pos, String createType) throws ParseException
      Parses create table schema statement after CREATE OR REPLACE SCHEMA statement which is handled in the SqlCreateOrReplace method. CREATE [OR REPLACE] SCHEMA [ LOAD 'file:///path/to/raw_schema' | ( col1 int, col2 varchar(10) not null ) ] [FOR TABLE dfs.my_table] [PATH 'file:///path/to/schema'] [PROPERTIES ('prop1'='val1', 'prop2'='val2')]
      Throws:
      ParseException
    • addProperty

      public final void addProperty(org.apache.calcite.sql.SqlNodeList properties) throws ParseException
      Helper method to add string literals divided by equals into SqlNodeList.
      Throws:
      ParseException
    • SqlDrop

      public final org.apache.calcite.sql.SqlNode SqlDrop() throws ParseException
      Parses DROP command for VIEW, TABLE and SCHEMA.
      Throws:
      ParseException
    • SqlDropView

      public final org.apache.calcite.sql.SqlNode SqlDropView(org.apache.calcite.sql.parser.SqlParserPos pos) throws ParseException
      Parses a drop view or drop view if exists statement after DROP VIEW statement which is handled in SqlDrop method. DROP VIEW [IF EXISTS] view_name;
      Throws:
      ParseException
    • SqlDropTable

      public final org.apache.calcite.sql.SqlNode SqlDropTable(org.apache.calcite.sql.parser.SqlParserPos pos) throws ParseException
      Parses a drop table or drop table if exists statement after DROP TABLE statement which is handled in SqlDrop method. DROP TABLE [IF EXISTS] table_name;
      Throws:
      ParseException
    • SqlDropSchema

      public final org.apache.calcite.sql.SqlNode SqlDropSchema(org.apache.calcite.sql.parser.SqlParserPos pos) throws ParseException
      Parses drop schema or drop schema if exists statement after DROP SCHEMA statement which is handled in SqlDrop method. DROP SCHEMA [IF EXISTS] FOR TABLE dfs.my_table
      Throws:
      ParseException
    • SqlRefreshMetadata

      public final org.apache.calcite.sql.SqlNode SqlRefreshMetadata() throws ParseException
      Parse refresh table metadata statement. REFRESH TABLE METADATA [COLUMNS ((field1, field2,..) | NONE)] table_name
      Throws:
      ParseException
    • SqlDescribeSchema

      public final org.apache.calcite.sql.SqlNode SqlDescribeSchema() throws ParseException
      Parses statement { DESCRIBE | DESC } { SCHEMA | DATABASE } name { DESCRIBE | DESC } SCHEMA FOR TABLE dfs.my_table [AS (JSON | STATEMENT)]
      Throws:
      ParseException
    • SqlAlterSchema

      public final org.apache.calcite.sql.SqlNode SqlAlterSchema() throws ParseException
      Parses ALTER SCHEMA statements: ALTER SCHEMA (FOR TABLE dfs.tmp.nation | PATH '/tmp/schema.json') ADD [OR REPLACE] [COLUMNS (col1 int, col2 varchar)] [PROPERTIES ('prop1'='val1', 'prop2'='val2')] ALTER SCHEMA (FOR TABLE dfs.tmp.nation | PATH '/tmp/schema.json') REMOVE [COLUMNS (`col1`, `col2`)] [PROPERTIES ('prop1', 'prop2')]
      Throws:
      ParseException
    • SqlAlterSchemaAdd

      public final org.apache.calcite.sql.SqlNode SqlAlterSchemaAdd(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlIdentifier table, org.apache.calcite.sql.SqlNode path) throws ParseException
      Throws:
      ParseException
    • ParseSchema

      public final org.apache.calcite.sql.SqlCharStringLiteral ParseSchema() throws ParseException
      Throws:
      ParseException
    • SqlAlterSchemaRemove

      public final org.apache.calcite.sql.SqlNode SqlAlterSchemaRemove(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlIdentifier table, org.apache.calcite.sql.SqlNode path) throws ParseException
      Throws:
      ParseException
    • SqlCreateFunction

      public final org.apache.calcite.sql.SqlNode SqlCreateFunction() throws ParseException
      Parse create UDF statement CREATE FUNCTION USING JAR 'jar_name'
      Throws:
      ParseException
    • SqlDropFunction

      public final org.apache.calcite.sql.SqlNode SqlDropFunction() throws ParseException
      Parse drop UDF statement DROP FUNCTION USING JAR 'jar_name'
      Throws:
      ParseException
    • SqlAnalyzeTable

      public final org.apache.calcite.sql.SqlNode SqlAnalyzeTable() throws ParseException
      Parses a analyze statements:
      • ANALYZE TABLE [table_name | table({table function name}(parameters))] [COLUMNS {(col1, col2, ...) | NONE}] REFRESH METADATA ['level' LEVEL] [{COMPUTE | ESTIMATE} | STATISTICS [ SAMPLE number PERCENT ]]
      • ANALYZE TABLE [table_name] DROP [METADATA|STATISTICS] [IF EXISTS]
      • ANALYZE TABLE [table_name | table({table function name}(parameters))] {COMPUTE | ESTIMATE} | STATISTICS [(column1, column2, ...)] [ SAMPLE numeric PERCENT ]
      Throws:
      ParseException
    • DrillSqlSetOption

      public final DrillSqlSetOption DrillSqlSetOption(org.apache.calcite.sql.parser.Span s, String scope) throws ParseException
      Parses a SET statement without a leading "ALTER ": SET <NAME> [ = VALUE ]

      Statement handles in: SetAndResetOptionHandler

      Throws:
      ParseException
    • DrillSqlResetOption

      public final DrillSqlResetOption DrillSqlResetOption(org.apache.calcite.sql.parser.Span s, String scope) throws ParseException
      Parses a RESET statement without a leading "ALTER ": RESET { | ALL }

      Statement handles in: SetAndResetOptionHandler

      Throws:
      ParseException
    • SqlCreateAlias

      public final org.apache.calcite.sql.SqlNode SqlCreateAlias(org.apache.calcite.sql.parser.SqlParserPos pos, boolean replace, boolean isPublic) throws ParseException
      Parses CREATE ALIAS statement CREATE [OR REPLACE] [PUBLIC] ALIAS `alias` FOR [TABLE | STORAGE] `table/storage` [AS USER 'username']
      Throws:
      ParseException
    • SqlDropAlias

      public final org.apache.calcite.sql.SqlNode SqlDropAlias() throws ParseException
      Parses DROP ALIAS statement DROP [PUBLIC] ALIAS [IF EXISTS] `employee-alias` [FOR (TABLE | STORAGE)] [AS USER 'username']
      Throws:
      ParseException
    • SqlDropAllAliases

      public final org.apache.calcite.sql.SqlNode SqlDropAllAliases() throws ParseException
      Parses DROP ALL ALIASES statement DROP ALL [PUBLIC] ALIASES [FOR (TABLE | STORAGE)] [AS USER 'username']
      Throws:
      ParseException
    • ParenthesizedKeyValueOptionCommaList

      public final org.apache.calcite.sql.SqlNodeList ParenthesizedKeyValueOptionCommaList() throws ParseException
      Throws:
      ParseException
    • AddKeyValueOption

      public final void AddKeyValueOption(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Parses an option with format key=val whose key is a simple identifier or string literal and value is a string literal.
      Throws:
      ParseException
    • AddOptionValue

      public final void AddOptionValue(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Parses an option value (either a string or a numeric) and adds to a list.
      Throws:
      ParseException
    • ParenthesizedLiteralOptionCommaList

      public final org.apache.calcite.sql.SqlNodeList ParenthesizedLiteralOptionCommaList() throws ParseException
      Parses a literal list separated by comma. The literal is either a string or a numeric.
      Throws:
      ParseException
    • AddHint

      public final void AddHint(List<org.apache.calcite.sql.SqlNode> hints) throws ParseException
      Throws:
      ParseException
    • TableHints

      public final org.apache.calcite.sql.SqlNode TableHints(org.apache.calcite.sql.SqlIdentifier tableName) throws ParseException
      Parses hints following a table reference, and returns the wrapped table reference.
      Throws:
      ParseException
    • SqlSelect

      public final org.apache.calcite.sql.SqlSelect SqlSelect() throws ParseException
      Parses a leaf SELECT expression without ORDER BY.
      Throws:
      ParseException
    • SqlExplain

      public final org.apache.calcite.sql.SqlNode SqlExplain() throws ParseException
      Parses an EXPLAIN PLAN statement.
      Throws:
      ParseException
    • SqlQueryOrDml

      public final org.apache.calcite.sql.SqlNode SqlQueryOrDml() throws ParseException
      Parses a query (SELECT or VALUES) or DML statement (INSERT, UPDATE, DELETE, MERGE).
      Throws:
      ParseException
    • ExplainDepth

      public final org.apache.calcite.sql.SqlExplain.Depth ExplainDepth() throws ParseException
      Parses WITH TYPE | WITH IMPLEMENTATION | WITHOUT IMPLEMENTATION modifier for EXPLAIN PLAN.
      Throws:
      ParseException
    • ExplainDetailLevel

      public final org.apache.calcite.sql.SqlExplainLevel ExplainDetailLevel() throws ParseException
      Parses INCLUDING ALL ATTRIBUTES modifier for EXPLAIN PLAN.
      Throws:
      ParseException
    • SqlDescribe

      public final org.apache.calcite.sql.SqlNode SqlDescribe() throws ParseException
      Parses a DESCRIBE statement.
      Throws:
      ParseException
    • SqlProcedureCall

      public final org.apache.calcite.sql.SqlNode SqlProcedureCall() throws ParseException
      Parses a CALL statement.
      Throws:
      ParseException
    • NamedRoutineCall

      public final org.apache.calcite.sql.SqlNode NamedRoutineCall(org.apache.calcite.sql.SqlFunctionCategory routineType, org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Throws:
      ParseException
    • TableParam

      public final org.apache.calcite.sql.SqlNode TableParam() throws ParseException
      Table parameter of a table function. The input table with set semantics may be partitioned/ordered on one or more columns.
      Throws:
      ParseException
    • PartitionedQueryOrQueryOrExpr

      public final org.apache.calcite.sql.SqlNode PartitionedQueryOrQueryOrExpr(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Throws:
      ParseException
    • PartitionedByAndOrderBy

      public final org.apache.calcite.sql.SqlNode PartitionedByAndOrderBy(org.apache.calcite.sql.SqlNode e) throws ParseException
      Throws:
      ParseException
    • OrderByOfSetSemanticsTable

      public final org.apache.calcite.sql.SqlNodeList OrderByOfSetSemanticsTable() throws ParseException
      Throws:
      ParseException
    • CreateSetSemanticsTableIfNeeded

      public final org.apache.calcite.sql.SqlNode CreateSetSemanticsTableIfNeeded(org.apache.calcite.sql.parser.Span s, org.apache.calcite.sql.SqlNode e, org.apache.calcite.sql.SqlNodeList partitionList, org.apache.calcite.sql.SqlNodeList orderList) throws ParseException
      Throws:
      ParseException
    • SqlInsert

      public final org.apache.calcite.sql.SqlNode SqlInsert() throws ParseException
      Parses an INSERT statement.
      Throws:
      ParseException
    • SqlDelete

      public final org.apache.calcite.sql.SqlNode SqlDelete() throws ParseException
      Parses a DELETE statement.
      Throws:
      ParseException
    • SqlUpdate

      public final org.apache.calcite.sql.SqlNode SqlUpdate() throws ParseException
      Parses an UPDATE statement.
      Throws:
      ParseException
    • SqlMerge

      public final org.apache.calcite.sql.SqlNode SqlMerge() throws ParseException
      Parses a MERGE statement.
      Throws:
      ParseException
    • WhenMatchedClause

      public final org.apache.calcite.sql.SqlUpdate WhenMatchedClause(org.apache.calcite.sql.SqlNode table, org.apache.calcite.sql.SqlIdentifier alias) throws ParseException
      Throws:
      ParseException
    • WhenNotMatchedClause

      public final org.apache.calcite.sql.SqlInsert WhenNotMatchedClause(org.apache.calcite.sql.SqlNode table) throws ParseException
      Throws:
      ParseException
    • AddSelectItem

      public final void AddSelectItem(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Parses one item in a select list.
      Throws:
      ParseException
    • SelectExpression

      public final org.apache.calcite.sql.SqlNode SelectExpression() throws ParseException
      Parses one unaliased expression in a select list.
      Throws:
      ParseException
    • Natural

      public final org.apache.calcite.sql.SqlLiteral Natural() throws ParseException
      Throws:
      ParseException
    • JoinType

      public final org.apache.calcite.sql.SqlLiteral JoinType() throws ParseException
      Throws:
      ParseException
    • FromClause

      public final org.apache.calcite.sql.SqlNode FromClause() throws ParseException
      Parses the FROM clause for a SELECT.

      FROM is mandatory in standard SQL, optional in dialects such as MySQL, PostgreSQL. The parser allows SELECT without FROM, but the validator fails if conformance is, say, STRICT_2003.

      Throws:
      ParseException
    • Join

      public final org.apache.calcite.sql.SqlNode Join() throws ParseException
      Throws:
      ParseException
    • JoinTable

      public final org.apache.calcite.sql.SqlNode JoinTable(org.apache.calcite.sql.SqlNode e) throws ParseException
      Matches "LEFT JOIN t ON ...", "RIGHT JOIN t USING ...", "JOIN t".
      Throws:
      ParseException
    • TableRef

      public final org.apache.calcite.sql.SqlNode TableRef() throws ParseException
      Parses a table reference in a FROM clause, not lateral unless LATERAL is explicitly specified.
      Throws:
      ParseException
    • TableRef1

      public final org.apache.calcite.sql.SqlNode TableRef1(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Throws:
      ParseException
    • TableRef2

      public final org.apache.calcite.sql.SqlNode TableRef2(boolean lateral) throws ParseException
      Parses a table reference in a FROM clause.
      Throws:
      ParseException
    • TableRef3

      public final org.apache.calcite.sql.SqlNode TableRef3(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext, boolean lateral) throws ParseException
      Throws:
      ParseException
    • Tablesample

      public final org.apache.calcite.sql.SqlNode Tablesample(org.apache.calcite.sql.SqlNode tableRef) throws ParseException
      Throws:
      ParseException
    • ExtendTable

      public final org.apache.calcite.sql.SqlNode ExtendTable(org.apache.calcite.sql.SqlNode tableRef) throws ParseException
      Wraps a table reference in a call to EXTEND if an optional "EXTEND" clause is present.
      Throws:
      ParseException
    • ExtendList

      public final org.apache.calcite.sql.SqlNodeList ExtendList() throws ParseException
      Throws:
      ParseException
    • AddColumnType

      public final void AddColumnType(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Throws:
      ParseException
    • AddCompoundIdentifierType

      public final void AddCompoundIdentifierType(List<org.apache.calcite.sql.SqlNode> list, List<org.apache.calcite.sql.SqlNode> extendList) throws ParseException
      Parses a compound identifier with optional type.
      Throws:
      ParseException
    • TableFunctionCall

      public final org.apache.calcite.sql.SqlNode TableFunctionCall() throws ParseException
      Throws:
      ParseException
    • ExplicitTable

      public final org.apache.calcite.sql.SqlNode ExplicitTable(org.apache.calcite.sql.parser.SqlParserPos pos) throws ParseException
      Parses an explicit TABLE t reference.
      Throws:
      ParseException
    • TableConstructor

      public final org.apache.calcite.sql.SqlNode TableConstructor() throws ParseException
      Parses a VALUES leaf query expression.
      Throws:
      ParseException
    • AddRowConstructor

      public final void AddRowConstructor(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Parses a row constructor and adds it to a list.
      Throws:
      ParseException
    • RowConstructor

      public final org.apache.calcite.sql.SqlNode RowConstructor() throws ParseException
      Parses a row constructor in the context of a VALUES expression.
      Throws:
      ParseException
    • Where

      public final org.apache.calcite.sql.SqlNode Where() throws ParseException
      Parses a WHERE clause for SELECT, DELETE, and UPDATE.
      Throws:
      ParseException
    • GroupBy

      public final org.apache.calcite.sql.SqlNodeList GroupBy() throws ParseException
      Parses a GROUP BY clause for SELECT.
      Throws:
      ParseException
    • GroupingElementList

      public final List<org.apache.calcite.sql.SqlNode> GroupingElementList() throws ParseException
      Throws:
      ParseException
    • AddGroupingElement

      public final void AddGroupingElement(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Throws:
      ParseException
    • ExpressionCommaList

      public final org.apache.calcite.sql.SqlNodeList ExpressionCommaList(org.apache.calcite.sql.parser.Span s, org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a list of expressions separated by commas.
      Throws:
      ParseException
    • AddExpressions

      public final void AddExpressions(List<org.apache.calcite.sql.SqlNode> list, org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a list of expressions separated by commas, appending expressions to a given list.
      Throws:
      ParseException
    • Having

      public final org.apache.calcite.sql.SqlNode Having() throws ParseException
      Parses a HAVING clause for SELECT.
      Throws:
      ParseException
    • Window

      public final org.apache.calcite.sql.SqlNodeList Window() throws ParseException
      Parses a WINDOW clause for SELECT.
      Throws:
      ParseException
    • AddWindowSpec

      public final void AddWindowSpec(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Throws:
      ParseException
    • WindowSpecification

      public final org.apache.calcite.sql.SqlWindow WindowSpecification() throws ParseException
      Parses a window specification.
      Throws:
      ParseException
    • WindowRange

      public final org.apache.calcite.sql.SqlNode WindowRange() throws ParseException
      Throws:
      ParseException
    • Qualify

      public final org.apache.calcite.sql.SqlNode Qualify() throws ParseException
      Parses a QUALIFY clause for SELECT.
      Throws:
      ParseException
    • OrderBy

      public final org.apache.calcite.sql.SqlNodeList OrderBy(boolean accept) throws ParseException
      Parses an ORDER BY clause.
      Throws:
      ParseException
    • AddOrderItem

      public final void AddOrderItem(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Parses one item in an ORDER BY clause, and adds it to a list.
      Throws:
      ParseException
    • Over

      public final org.apache.calcite.sql.SqlNode Over(org.apache.calcite.sql.SqlNode tableRef) throws ParseException
      Wraps a table reference in a call to OVER if an optional "OVER" clause is present (if the dialect supports OVER for table expressions).
      Throws:
      ParseException
    • Snapshot

      public final org.apache.calcite.sql.SqlSnapshot Snapshot(org.apache.calcite.sql.SqlNode tableRef) throws ParseException
      Parses a FOR SYSTEM_TIME clause following a table expression.
      Throws:
      ParseException
    • Pivot

      public final org.apache.calcite.sql.SqlNode Pivot(org.apache.calcite.sql.SqlNode tableRef) throws ParseException
      Parses a PIVOT clause following a table expression.
      Throws:
      ParseException
    • AddPivotAgg

      public final void AddPivotAgg(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Throws:
      ParseException
    • AddPivotValue

      public final void AddPivotValue(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Throws:
      ParseException
    • Unpivot

      public final org.apache.calcite.sql.SqlNode Unpivot(org.apache.calcite.sql.SqlNode tableRef) throws ParseException
      Parses an UNPIVOT clause following a table expression.
      Throws:
      ParseException
    • AddUnpivotValue

      public final void AddUnpivotValue(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Throws:
      ParseException
    • MatchRecognize

      public final org.apache.calcite.sql.SqlMatchRecognize MatchRecognize(org.apache.calcite.sql.SqlNode tableRef) throws ParseException
      Parses a MATCH_RECOGNIZE clause following a table expression.
      Throws:
      ParseException
    • MeasureColumnCommaList

      public final org.apache.calcite.sql.SqlNodeList MeasureColumnCommaList(org.apache.calcite.sql.parser.Span s) throws ParseException
      Throws:
      ParseException
    • AddMeasureColumn

      public final void AddMeasureColumn(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Throws:
      ParseException
    • PatternExpression

      public final org.apache.calcite.sql.SqlNode PatternExpression() throws ParseException
      Throws:
      ParseException
    • PatternTerm

      public final org.apache.calcite.sql.SqlNode PatternTerm() throws ParseException
      Throws:
      ParseException
    • PatternFactor

      public final org.apache.calcite.sql.SqlNode PatternFactor() throws ParseException
      Throws:
      ParseException
    • PatternPrimary

      public final org.apache.calcite.sql.SqlNode PatternPrimary() throws ParseException
      Throws:
      ParseException
    • SubsetDefinitionCommaList

      public final org.apache.calcite.sql.SqlNodeList SubsetDefinitionCommaList(org.apache.calcite.sql.parser.Span s) throws ParseException
      Throws:
      ParseException
    • AddSubsetDefinition

      public final void AddSubsetDefinition(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Throws:
      ParseException
    • PatternDefinitionCommaList

      public final org.apache.calcite.sql.SqlNodeList PatternDefinitionCommaList(org.apache.calcite.sql.parser.Span s) throws ParseException
      Throws:
      ParseException
    • PatternDefinition

      public final org.apache.calcite.sql.SqlNode PatternDefinition() throws ParseException
      Throws:
      ParseException
    • SqlExpressionEof

      public final org.apache.calcite.sql.SqlNode SqlExpressionEof() throws ParseException
      Parses a SQL expression (such as might occur in a WHERE clause) followed by the end-of-file symbol.
      Throws:
      ParseException
    • QueryOrExpr

      public final org.apache.calcite.sql.SqlNode QueryOrExpr(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses either a row expression or a query expression without ORDER BY.

      Examples of valid queries:

      • SELECT c FROM t
      • SELECT c (valid in some dialects)
      • SELECT c FROM t UNION SELECT c2 FROM t2
      • WITH q AS (SELECT 1) SELECT * FROM q
      • VALUES (1, 2)
      • TABLE t

      Non-examples:

      • emp CROSS JOIN dept
      • SELECT c FROM t ORDER BY c
      • (SELECT c FROM t)
      Throws:
      ParseException
    • Query

      public final org.apache.calcite.sql.SqlNode Query(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Throws:
      ParseException
    • AddSetOpQueryOrExpr

      public final void AddSetOpQueryOrExpr(List<Object> list, org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a set operator (e.g. UNION or INTERSECT) followed by a query or expression, and adds both to list.
      Throws:
      ParseException
    • AddSetOpQuery

      public final void AddSetOpQuery(List<Object> list, org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a set operator (e.g. UNION or INTERSECT) followed by a query, and adds both to list.
      Throws:
      ParseException
    • WithList

      public final org.apache.calcite.sql.SqlNodeList WithList() throws ParseException
      Throws:
      ParseException
    • AddWithItem

      public final void AddWithItem(List<org.apache.calcite.sql.SqlWithItem> list) throws ParseException
      Throws:
      ParseException
    • LeafQueryOrExpr

      public final org.apache.calcite.sql.SqlNode LeafQueryOrExpr(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses either a row expression, a leaf query expression, or a parenthesized expression of any kind.
      Throws:
      ParseException
    • AddExpression

      public final void AddExpression(List<org.apache.calcite.sql.SqlNode> list, org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Throws:
      ParseException
    • Expression

      public final org.apache.calcite.sql.SqlNode Expression(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a row expression or a parenthesized expression of any kind.
      Throws:
      ParseException
    • AddExpression2b

      public final void AddExpression2b(List<Object> list, org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Throws:
      ParseException
    • Expression2

      public final List<Object> Expression2(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a binary row expression, or a parenthesized expression of any kind.

      The result is as a flat list of operators and operands. The top-level call to get an expression should call Expression(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext), but lower-level calls should call this, to give the parser the opportunity to associate operator calls.

      For example 'a = b like c = d' should come out '((a = b) like c) = d' because LIKE and '=' have the same precedence, but tends to come out as '(a = b) like (c = d)' because (a = b) and (c = d) are parsed as separate expressions.

      Throws:
      ParseException
    • comp

      public final org.apache.calcite.sql.SqlKind comp() throws ParseException
      Parses a comparison operator inside a SOME / ALL predicate.
      Throws:
      ParseException
    • Expression3

      public final org.apache.calcite.sql.SqlNode Expression3(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a unary row expression, or a parenthesized expression of any kind.
      Throws:
      ParseException
    • periodOperator

      public final org.apache.calcite.sql.SqlOperator periodOperator() throws ParseException
      Throws:
      ParseException
    • CollateClause

      public final org.apache.calcite.sql.SqlCollation CollateClause() throws ParseException
      Parses a COLLATE clause
      Throws:
      ParseException
    • UnsignedNumericLiteralOrParam

      public final org.apache.calcite.sql.SqlNode UnsignedNumericLiteralOrParam() throws ParseException
      Numeric literal or parameter; used in LIMIT, OFFSET and FETCH clauses.
      Throws:
      ParseException
    • RowExpressionExtension

      public final org.apache.calcite.sql.SqlNode RowExpressionExtension() throws ParseException
      Parses a row expression extension, it can be either an identifier, or a call to a named function.
      Throws:
      ParseException
    • StringAggFunctionCall

      public final org.apache.calcite.sql.SqlCall StringAggFunctionCall() throws ParseException
      Parses a call to the STRING_AGG aggregate function (or to an aggregate function with similar syntax: ARRAY_AGG, ARRAY_CONCAT_AGG, GROUP_CONCAT).
      Throws:
      ParseException
    • AtomicRowExpression

      public final org.apache.calcite.sql.SqlNode AtomicRowExpression() throws ParseException
      Parses an atomic row expression.
      Throws:
      ParseException
    • CaseExpression

      public final org.apache.calcite.sql.SqlNode CaseExpression() throws ParseException
      Throws:
      ParseException
    • SequenceExpression

      public final org.apache.calcite.sql.SqlCall SequenceExpression() throws ParseException
      Throws:
      ParseException
    • SqlSetOption

      public final org.apache.calcite.sql.SqlSetOption SqlSetOption(org.apache.calcite.sql.parser.Span s, String scope) throws ParseException
      Parses "SET <NAME> = VALUE" or "RESET <NAME>", without a leading "ALTER <SCOPE>".
      Throws:
      ParseException
    • SqlAlter

      public final org.apache.calcite.sql.SqlAlter SqlAlter() throws ParseException
      Parses an expression for setting or resetting an option in SQL, such as QUOTED_IDENTIFIERS, or explain plan level (physical/logical).
      Throws:
      ParseException
    • Scope

      public final String Scope() throws ParseException
      Throws:
      ParseException
    • Literal

      public final org.apache.calcite.sql.SqlNode Literal() throws ParseException
      Parses a literal expression, allowing continued string literals. Usually returns an SqlLiteral, but a continued string literal is an SqlCall expression, which concatenates 2 or more string literals; the validator reduces this.

      If the context allows both literals and expressions, use LiteralOrIntervalExpression(), which requires less lookahead.

      Throws:
      ParseException
    • NonIntervalLiteral

      public final org.apache.calcite.sql.SqlNode NonIntervalLiteral() throws ParseException
      Parses a literal that is not an interval literal.
      Throws:
      ParseException
    • LiteralOrIntervalExpression

      public final org.apache.calcite.sql.SqlNode LiteralOrIntervalExpression() throws ParseException
      Parses a literal or an interval expression.

      We include them in the same production because it is difficult to distinguish interval literals from interval expression (both of which start with the INTERVAL keyword); this way, we can use less LOOKAHEAD.

      Throws:
      ParseException
    • UnsignedNumericLiteral

      public final org.apache.calcite.sql.SqlNumericLiteral UnsignedNumericLiteral() throws ParseException
      Parses a unsigned numeric literal
      Throws:
      ParseException
    • NumericLiteral

      public final org.apache.calcite.sql.SqlLiteral NumericLiteral() throws ParseException
      Parses a numeric literal (can be signed)
      Throws:
      ParseException
    • SpecialLiteral

      public final org.apache.calcite.sql.SqlLiteral SpecialLiteral() throws ParseException
      Parse a special literal keyword
      Throws:
      ParseException
    • StringLiteral

      public final org.apache.calcite.sql.SqlNode StringLiteral() throws ParseException
      Parses a string literal. The literal may be continued onto several lines. For a simple literal, the result is an SqlLiteral. For a continued literal, the result is an SqlCall expression, which concatenates 2 or more string literals; the validator reduces this.
      Returns:
      a literal expression
      Throws:
      ParseException
      See Also:
      • SqlLiteral.unchain(SqlNode)
      • SqlLiteral.stringValue(SqlNode)
    • SimpleStringLiteral

      public final String SimpleStringLiteral() throws ParseException
      Parses a character literal. Matches a single-quoted string, such as 'foo'; on BigQuery also matches a double-quoted string, such as "foo". Returns the value of the string with quotes removed.
      Throws:
      ParseException
    • DateTimeLiteral

      public final org.apache.calcite.sql.SqlLiteral DateTimeLiteral() throws ParseException
      Parses a date/time literal.
      Throws:
      ParseException
    • DateTimeConstructorCall

      public final org.apache.calcite.sql.SqlNode DateTimeConstructorCall() throws ParseException
      Parses a Date/Time constructor function, for example "DATE(1969, 7, 21)" or "DATETIME(d, t)". Enabled in some libraries (e.g. BigQuery).
      Throws:
      ParseException
    • MultisetConstructor

      public final org.apache.calcite.sql.SqlNode MultisetConstructor() throws ParseException
      Parses a MULTISET constructor
      Throws:
      ParseException
    • ArrayConstructor

      public final org.apache.calcite.sql.SqlNode ArrayConstructor() throws ParseException
      Parses an ARRAY constructor
      Throws:
      ParseException
    • ArrayLiteral

      public final org.apache.calcite.sql.SqlCall ArrayLiteral() throws ParseException
      Throws:
      ParseException
    • MapConstructor

      public final org.apache.calcite.sql.SqlNode MapConstructor() throws ParseException
      Parses a MAP constructor
      Throws:
      ParseException
    • PeriodConstructor

      public final org.apache.calcite.sql.SqlNode PeriodConstructor() throws ParseException
      Parses a PERIOD constructor
      Throws:
      ParseException
    • IntervalLiteral

      public final org.apache.calcite.sql.SqlLiteral IntervalLiteral() throws ParseException
      Parses an interval literal.
      Throws:
      ParseException
    • IntervalLiteralOrExpression

      public final org.apache.calcite.sql.SqlNode IntervalLiteralOrExpression() throws ParseException
      Parses an interval literal (e.g. INTERVAL '2:3' HOUR TO MINUTE) or an interval expression (e.g. INTERVAL emp.empno MINUTE or INTERVAL 3 MONTHS).
      Throws:
      ParseException
    • Year

      public final org.apache.calcite.avatica.util.TimeUnit Year() throws ParseException
      Throws:
      ParseException
    • Quarter

      public final org.apache.calcite.avatica.util.TimeUnit Quarter() throws ParseException
      Throws:
      ParseException
    • Month

      public final org.apache.calcite.avatica.util.TimeUnit Month() throws ParseException
      Throws:
      ParseException
    • Week

      public final org.apache.calcite.avatica.util.TimeUnit Week() throws ParseException
      Throws:
      ParseException
    • Day

      public final org.apache.calcite.avatica.util.TimeUnit Day() throws ParseException
      Throws:
      ParseException
    • Hour

      public final org.apache.calcite.avatica.util.TimeUnit Hour() throws ParseException
      Throws:
      ParseException
    • Minute

      public final org.apache.calcite.avatica.util.TimeUnit Minute() throws ParseException
      Throws:
      ParseException
    • Second

      public final org.apache.calcite.avatica.util.TimeUnit Second() throws ParseException
      Throws:
      ParseException
    • IntervalQualifier

      public final org.apache.calcite.sql.SqlIntervalQualifier IntervalQualifier() throws ParseException
      Throws:
      ParseException
    • IntervalQualifierStart

      public final org.apache.calcite.sql.SqlIntervalQualifier IntervalQualifierStart() throws ParseException
      Interval qualifier without 'TO unit'.
      Throws:
      ParseException
    • TimeUnitOrName

      public final org.apache.calcite.sql.SqlIntervalQualifier TimeUnitOrName() throws ParseException
      Parses a built-in time unit (e.g. "YEAR") or user-defined time frame (e.g. "MINUTE15") and in each case returns a SqlIntervalQualifier.

      The units are used in several functions, incuding CEIL, FLOOR, EXTRACT. Includes NANOSECOND, MILLISECOND, which were previously allowed in EXTRACT but not CEIL, FLOOR.

      Includes WEEK and WEEK(SUNDAY) through WEEK(SATURDAY).

      Does not include SQL_TSI_DAY, SQL_TSI_FRAC_SECOND etc. These will be parsed as identifiers and can be resolved in the validator if they are registered as abbreviations in your time frame set.

      Throws:
      ParseException
    • TimeUnit

      public final org.apache.calcite.sql.SqlIntervalQualifier TimeUnit() throws ParseException
      Parses a built-in time unit (e.g. "YEAR") and returns a SqlIntervalQualifier.

      Includes WEEK and WEEK(SUNDAY) through WEEK(SATURDAY).

      Does not include SQL_TSI_DAY, SQL_TSI_FRAC_SECOND etc. These will be parsed as identifiers and can be resolved in the validator if they are registered as abbreviations in your time frame set.

      Throws:
      ParseException
    • weekdayName

      public final String weekdayName() throws ParseException
      Throws:
      ParseException
    • DynamicParam

      public final org.apache.calcite.sql.SqlDynamicParam DynamicParam() throws ParseException
      Parses a dynamic parameter marker.
      Throws:
      ParseException
    • AddIdentifierSegment

      public final void AddIdentifierSegment(List<String> names, List<org.apache.calcite.sql.parser.SqlParserPos> positions) throws ParseException
      Parses one segment of an identifier that may be composite.

      Each time it reads an identifier it writes one element to each list; the entry in positions records its position and whether the segment was quoted.

      Throws:
      ParseException
    • AddTableIdentifierSegment

      public final void AddTableIdentifierSegment(List<String> names, List<org.apache.calcite.sql.parser.SqlParserPos> positions) throws ParseException
      As AddIdentifierSegment(java.util.List<java.lang.String>, java.util.List<org.apache.calcite.sql.parser.SqlParserPos>) but part of a table name (for example, following FROM, INSERT or UPDATE).

      In some dialects the lexical rules for table names are different from for other identifiers. For example, in BigQuery, table names may contain hyphens.

      Throws:
      ParseException
    • Identifier

      public final String Identifier() throws ParseException
      Parses a simple identifier as a String.
      Throws:
      ParseException
    • SimpleIdentifier

      public final org.apache.calcite.sql.SqlIdentifier SimpleIdentifier() throws ParseException
      Parses a simple identifier as an SqlIdentifier.
      Throws:
      ParseException
    • SimpleIdentifierFromStringLiteral

      public final org.apache.calcite.sql.SqlIdentifier SimpleIdentifierFromStringLiteral() throws ParseException
      Parses a character literal as an SqlIdentifier. Only valid for column aliases in certain dialects.
      Throws:
      ParseException
    • AddSimpleIdentifiers

      public final void AddSimpleIdentifiers(List<org.apache.calcite.sql.SqlNode> list) throws ParseException
      Parses a comma-separated list of simple identifiers.
      Throws:
      ParseException
    • ParenthesizedSimpleIdentifierList

      public final org.apache.calcite.sql.SqlNodeList ParenthesizedSimpleIdentifierList() throws ParseException
      List of simple identifiers in parentheses. The position extends from the open parenthesis to the close parenthesis.
      Throws:
      ParseException
    • SimpleIdentifierOrList

      public final org.apache.calcite.sql.SqlNodeList SimpleIdentifierOrList() throws ParseException
      List of simple identifiers in parentheses or one simple identifier.
        Examples:
      • DEPTNO
      • (EMPNO, DEPTNO)
      Throws:
      ParseException
    • CompoundIdentifier

      public final org.apache.calcite.sql.SqlIdentifier CompoundIdentifier() throws ParseException
      Parses a Drill compound identifier.
      Throws:
      ParseException
    • CompoundTableIdentifier

      public final org.apache.calcite.sql.SqlIdentifier CompoundTableIdentifier() throws ParseException
      Parses a compound identifier in the FROM clause.
      Throws:
      ParseException
    • AddCompoundIdentifierTypeCommaList

      public final void AddCompoundIdentifierTypeCommaList(List<org.apache.calcite.sql.SqlNode> list, List<org.apache.calcite.sql.SqlNode> extendList) throws ParseException
      Parses a comma-separated list of compound identifiers.
      Throws:
      ParseException
    • ParenthesizedCompoundIdentifierList

      public final org.apache.calcite.util.Pair<org.apache.calcite.sql.SqlNodeList,org.apache.calcite.sql.SqlNodeList> ParenthesizedCompoundIdentifierList() throws ParseException
      List of compound identifiers in parentheses. The position extends from the open parenthesis to the close parenthesis.
      Throws:
      ParseException
    • NewSpecification

      public final org.apache.calcite.sql.SqlNode NewSpecification() throws ParseException
      Parses a NEW UDT(...) expression.
      Throws:
      ParseException
    • UnsignedIntLiteral

      public final int UnsignedIntLiteral() throws ParseException
      Throws:
      ParseException
    • IntLiteral

      public final int IntLiteral() throws ParseException
      Throws:
      ParseException
    • DataType

      public final org.apache.calcite.sql.SqlDataTypeSpec DataType() throws ParseException
      Throws:
      ParseException
    • TypeName

      public final org.apache.calcite.sql.SqlTypeNameSpec TypeName() throws ParseException
      Throws:
      ParseException
    • SqlTypeName

      public final org.apache.calcite.sql.SqlTypeNameSpec SqlTypeName(org.apache.calcite.sql.parser.Span s) throws ParseException
      Throws:
      ParseException
    • SqlTypeName1

      public final org.apache.calcite.sql.SqlTypeNameSpec SqlTypeName1(org.apache.calcite.sql.parser.Span s) throws ParseException
      Throws:
      ParseException
    • SqlTypeName2

      public final org.apache.calcite.sql.SqlTypeNameSpec SqlTypeName2(org.apache.calcite.sql.parser.Span s) throws ParseException
      Throws:
      ParseException
    • SqlTypeName3

      public final org.apache.calcite.sql.SqlTypeNameSpec SqlTypeName3(org.apache.calcite.sql.parser.Span s) throws ParseException
      Throws:
      ParseException
    • JdbcOdbcDataTypeName

      public final org.apache.calcite.sql.SqlJdbcDataTypeName JdbcOdbcDataTypeName() throws ParseException
      Throws:
      ParseException
    • JdbcOdbcDataType

      public final org.apache.calcite.sql.SqlLiteral JdbcOdbcDataType() throws ParseException
      Throws:
      ParseException
    • CollectionsTypeName

      public final org.apache.calcite.sql.SqlTypeNameSpec CollectionsTypeName(org.apache.calcite.sql.SqlTypeNameSpec elementTypeName) throws ParseException
      Parse a collection type name, the input element type name may also be a collection type.
      Throws:
      ParseException
    • NullableOptDefaultTrue

      public final boolean NullableOptDefaultTrue() throws ParseException
      Parse a nullable option, default is true.
      Throws:
      ParseException
    • NullableOptDefaultFalse

      public final boolean NullableOptDefaultFalse() throws ParseException
      Parse a nullable option, default is false.
      Throws:
      ParseException
    • NotNullOpt

      public final boolean NotNullOpt() throws ParseException
      Parses NOT NULL and returns false, or parses nothing and returns true.
      Throws:
      ParseException
    • AddFieldNameTypes

      public final void AddFieldNameTypes(List<org.apache.calcite.sql.SqlIdentifier> fieldNames, List<org.apache.calcite.sql.SqlDataTypeSpec> fieldTypes) throws ParseException
      Parse a "name1 type1 [NULL | NOT NULL], name2 type2 [NULL | NOT NULL] ..." list, the field type default is not nullable.
      Throws:
      ParseException
    • AddFieldNameType

      public final void AddFieldNameType(List<org.apache.calcite.sql.SqlIdentifier> fieldNames, List<org.apache.calcite.sql.SqlDataTypeSpec> fieldTypes) throws ParseException
      Throws:
      ParseException
    • RowTypeName

      public final org.apache.calcite.sql.SqlTypeNameSpec RowTypeName() throws ParseException
      Parse Row type with format: Row(name1 type1, name2 type2). Every field type can have suffix of `NULL` or `NOT NULL` to indicate if this type is nullable. i.e. Row(f0 int not null, f1 varchar null).
      Throws:
      ParseException
    • CharacterTypeName

      public final org.apache.calcite.sql.SqlTypeNameSpec CharacterTypeName(org.apache.calcite.sql.parser.Span s) throws ParseException
      Parse character types: char, varchar.
      Throws:
      ParseException
    • DateTimeTypeName

      public final org.apache.calcite.sql.SqlTypeNameSpec DateTimeTypeName() throws ParseException
      Parse datetime types: date, time, timestamp.
      Throws:
      ParseException
    • PrecisionOpt

      public final int PrecisionOpt() throws ParseException
      Throws:
      ParseException
    • TimeZoneOpt

      public final boolean TimeZoneOpt() throws ParseException
      Parse a time zone suffix for DateTime types. According to SQL-2011, "with time zone" and "without time zone" belong to standard SQL but we only implement the "without time zone".

      We also support "with local time zone".

      Returns:
      true if this is "with local time zone".
      Throws:
      ParseException
    • CursorExpression

      public final org.apache.calcite.sql.SqlNode CursorExpression(org.apache.calcite.sql.parser.SqlAbstractParserImpl.ExprContext exprContext) throws ParseException
      Parses a CURSOR(query) expression. The parser allows these anywhere, but the validator restricts them to appear only as arguments to table functions.
      Throws:
      ParseException
    • BuiltinFunctionCall

      public final org.apache.calcite.sql.SqlNode BuiltinFunctionCall() throws ParseException
      Parses a call to a builtin function with special syntax.
      Throws:
      ParseException
    • JsonRepresentation

      public final org.apache.calcite.sql.SqlJsonEncoding JsonRepresentation() throws ParseException
      Throws:
      ParseException
    • JsonInputClause

      public final void JsonInputClause() throws ParseException
      Throws:
      ParseException
    • JsonReturningClause

      public final org.apache.calcite.sql.SqlDataTypeSpec JsonReturningClause() throws ParseException
      Throws:
      ParseException
    • JsonOutputClause

      public final org.apache.calcite.sql.SqlDataTypeSpec JsonOutputClause() throws ParseException
      Throws:
      ParseException
    • JsonPathSpec

      public final org.apache.calcite.sql.SqlNode JsonPathSpec() throws ParseException
      Throws:
      ParseException
    • JsonApiCommonSyntax

      public final List<org.apache.calcite.sql.SqlNode> JsonApiCommonSyntax() throws ParseException
      Throws:
      ParseException
    • JsonExistsErrorBehavior

      public final org.apache.calcite.sql.SqlJsonExistsErrorBehavior JsonExistsErrorBehavior() throws ParseException
      Throws:
      ParseException
    • JsonExistsFunctionCall

      public final org.apache.calcite.sql.SqlCall JsonExistsFunctionCall() throws ParseException
      Throws:
      ParseException
    • JsonValueEmptyOrErrorBehavior

      public final List<org.apache.calcite.sql.SqlNode> JsonValueEmptyOrErrorBehavior() throws ParseException
      Throws:
      ParseException
    • JsonValueFunctionCall

      public final org.apache.calcite.sql.SqlCall JsonValueFunctionCall() throws ParseException
      Throws:
      ParseException
    • JsonQueryEmptyOrErrorBehavior

      public final List<org.apache.calcite.sql.SqlNode> JsonQueryEmptyOrErrorBehavior() throws ParseException
      Throws:
      ParseException
    • JsonQueryWrapperBehavior

      public final org.apache.calcite.sql.SqlNode JsonQueryWrapperBehavior() throws ParseException
      Throws:
      ParseException
    • JsonQueryFunctionCall

      public final org.apache.calcite.sql.SqlCall JsonQueryFunctionCall() throws ParseException
      Throws:
      ParseException
    • JsonName

      public final org.apache.calcite.sql.SqlNode JsonName() throws ParseException
      Throws:
      ParseException
    • JsonNameAndValue

      public final List<org.apache.calcite.sql.SqlNode> JsonNameAndValue() throws ParseException
      Throws:
      ParseException
    • JsonConstructorNullClause

      public final org.apache.calcite.sql.SqlNode JsonConstructorNullClause() throws ParseException
      Throws:
      ParseException
    • JsonObjectFunctionCall

      public final org.apache.calcite.sql.SqlCall JsonObjectFunctionCall() throws ParseException
      Throws:
      ParseException
    • JsonObjectAggFunctionCall

      public final org.apache.calcite.sql.SqlCall JsonObjectAggFunctionCall() throws ParseException
      Throws:
      ParseException
    • JsonArrayFunctionCall

      public final org.apache.calcite.sql.SqlCall JsonArrayFunctionCall() throws ParseException
      Throws:
      ParseException
    • JsonArrayAggOrderByClause

      public final org.apache.calcite.sql.SqlNodeList JsonArrayAggOrderByClause() throws ParseException
      Throws:
      ParseException
    • JsonArrayAggFunctionCall

      public final org.apache.calcite.sql.SqlCall JsonArrayAggFunctionCall() throws ParseException
      Throws:
      ParseException
    • TimestampAddFunctionCall

      public final org.apache.calcite.sql.SqlCall TimestampAddFunctionCall() throws ParseException
      Parses a call to TIMESTAMPADD.
      Throws:
      ParseException
    • TimestampDiffFunctionCall

      public final org.apache.calcite.sql.SqlCall TimestampDiffFunctionCall() throws ParseException
      Parses a call to TIMESTAMPDIFF.
      Throws:
      ParseException
    • TimestampDiff3FunctionCall

      public final org.apache.calcite.sql.SqlCall TimestampDiff3FunctionCall() throws ParseException
      Parses a call to BigQuery's TIMESTAMP_DIFF.

      The difference between TIMESTAMPDIFF and TIMESTAMP_DIFF is the ordering of the parameters and the arrangement of the subtraction. TIMESTAMPDIFF uses (unit, timestamp1, timestamp2) with (t2 - t1), while TIMESTAMP_DIFF uses (timestamp1, timestamp2, unit) with (t1 - t2).

      Throws:
      ParseException
    • DateTruncFunctionCall

      public final org.apache.calcite.sql.SqlCall DateTruncFunctionCall() throws ParseException
      Parses a call to DATE_TRUNC.
      Throws:
      ParseException
    • TimestampTruncFunctionCall

      public final org.apache.calcite.sql.SqlCall TimestampTruncFunctionCall() throws ParseException
      Parses a call to TIMESTAMP_TRUNC.
      Throws:
      ParseException
    • TimeDiffFunctionCall

      public final org.apache.calcite.sql.SqlCall TimeDiffFunctionCall() throws ParseException
      Parses a call to BigQuery's TIME_DIFF.
      Throws:
      ParseException
    • TimeTruncFunctionCall

      public final org.apache.calcite.sql.SqlCall TimeTruncFunctionCall() throws ParseException
      Parses a call to TIME_TRUNC.
      Throws:
      ParseException
    • GroupByWindowingCall

      public final org.apache.calcite.sql.SqlCall GroupByWindowingCall() throws ParseException
      Parses a call to a grouping function inside the GROUP BY clause, for example TUMBLE(rowtime, INTERVAL '1' MINUTE).
      Throws:
      ParseException
    • MatchRecognizeFunctionCall

      public final org.apache.calcite.sql.SqlCall MatchRecognizeFunctionCall() throws ParseException
      Throws:
      ParseException
    • MatchRecognizeCallWithModifier

      public final org.apache.calcite.sql.SqlCall MatchRecognizeCallWithModifier() throws ParseException
      Throws:
      ParseException
    • MatchRecognizeNavigationLogical

      public final org.apache.calcite.sql.SqlCall MatchRecognizeNavigationLogical() throws ParseException
      Throws:
      ParseException
    • MatchRecognizeNavigationPhysical

      public final org.apache.calcite.sql.SqlCall MatchRecognizeNavigationPhysical() throws ParseException
      Throws:
      ParseException
    • withinDistinct

      public final org.apache.calcite.sql.SqlCall withinDistinct(org.apache.calcite.sql.SqlNode arg) throws ParseException
      Throws:
      ParseException
    • withinGroup

      public final org.apache.calcite.sql.SqlCall withinGroup(org.apache.calcite.sql.SqlNode arg) throws ParseException
      Throws:
      ParseException
    • NullTreatment

      public final org.apache.calcite.util.Pair<org.apache.calcite.sql.parser.SqlParserPos,org.apache.calcite.sql.SqlOperator> NullTreatment() throws ParseException
      Throws:
      ParseException
    • nullTreatment

      public final org.apache.calcite.sql.SqlCall nullTreatment(org.apache.calcite.sql.SqlCall arg) throws ParseException
      Throws:
      ParseException
    • NamedFunctionCall

      public final org.apache.calcite.sql.SqlNode NamedFunctionCall() throws ParseException
      Parses a call to a named function (could be a builtin with regular syntax, or else a UDF).

      NOTE: every UDF has two names: an invocation name and a specific name. Normally, function calls are resolved via overload resolution and invocation names. The SPECIFIC prefix allows overload resolution to be bypassed. Note that usage of the SPECIFIC prefix in queries is non-standard; it is used internally by Farrago, e.g. in stored view definitions to permanently bind references to a particular function after the overload resolution performed by view creation.

      TODO jvs 25-Mar-2005: Once we have SQL-Flagger support, flag SPECIFIC as non-standard.

      Throws:
      ParseException
    • NamedCall

      public final org.apache.calcite.sql.SqlCall NamedCall() throws ParseException
      Throws:
      ParseException
    • StandardFloorCeilOptions

      public final org.apache.calcite.sql.SqlNode StandardFloorCeilOptions(org.apache.calcite.sql.parser.Span s, boolean floorFlag) throws ParseException
      Throws:
      ParseException
    • NonReservedJdbcFunctionName

      public final String NonReservedJdbcFunctionName() throws ParseException
      Parses the name of a JDBC function that is a token but is not reserved.
      Throws:
      ParseException
    • FunctionName

      public final org.apache.calcite.sql.SqlIdentifier FunctionName() throws ParseException
      Parses the name of a function (either a compound identifier or a reserved word which can be used as a function name).
      Throws:
      ParseException
    • ReservedFunctionName

      public final org.apache.calcite.sql.SqlIdentifier ReservedFunctionName() throws ParseException
      Parses a reserved word which is used as the name of a function.
      Throws:
      ParseException
    • ContextVariable

      public final org.apache.calcite.sql.SqlIdentifier ContextVariable() throws ParseException
      Throws:
      ParseException
    • JdbcFunctionCall

      public final org.apache.calcite.sql.SqlNode JdbcFunctionCall() throws ParseException
      Parses a function call expression with JDBC syntax.
      Throws:
      ParseException
    • BinaryQueryOperator

      public final org.apache.calcite.sql.SqlBinaryOperator BinaryQueryOperator() throws ParseException
      Parses a binary query operator like UNION.
      Throws:
      ParseException
    • BinaryMultisetOperator

      public final org.apache.calcite.sql.SqlBinaryOperator BinaryMultisetOperator() throws ParseException
      Parses a binary multiset operator.
      Throws:
      ParseException
    • BinaryRowOperator

      public final org.apache.calcite.sql.SqlBinaryOperator BinaryRowOperator() throws ParseException
      Parses a binary row operator like AND.
      Throws:
      ParseException
    • PrefixRowOperator

      public final org.apache.calcite.sql.SqlPrefixOperator PrefixRowOperator() throws ParseException
      Parses a prefix row operator like NOT.
      Throws:
      ParseException
    • PostfixRowOperator

      public final org.apache.calcite.sql.SqlPostfixOperator PostfixRowOperator() throws ParseException
      Parses a postfix row operator like IS NOT NULL.
      Throws:
      ParseException
    • NonReservedKeyWord

      public final String NonReservedKeyWord() throws ParseException
      Parses a non-reserved keyword for use as an identifier.

      The method is broken up into several sub-methods; without this decomposition, parsers such as Babel with more than ~1,000 non-reserved keywords would generate such deeply nested 'if' statements that javac would fail with a StackOverflowError.

      The list is generated from the FMPP config data. To add or remove keywords, modify config.fmpp. For parsers except Babel, make sure that keywords are not reserved by the SQL standard.

      Throws:
      ParseException
      See Also:
      • SQL:2003 Part 2 Section 5.2
    • NonReservedKeyWord0of3

      public final void NonReservedKeyWord0of3() throws ParseException
      Throws:
      ParseException
      See Also:
    • NonReservedKeyWord1of3

      public final void NonReservedKeyWord1of3() throws ParseException
      Throws:
      ParseException
      See Also:
    • NonReservedKeyWord2of3

      public final void NonReservedKeyWord2of3() throws ParseException
      Throws:
      ParseException
      See Also:
    • UnusedExtension

      public final void UnusedExtension() throws ParseException
      Defines a production which can never be accepted by the parser. In effect, it tells the parser, "If you got here, you've gone too far." It is used as the default production for parser extension points; derived parsers replace it with a real production when they want to implement a particular extension point.
      Throws:
      ParseException
    • ReInit

      public void ReInit(InputStream stream)
      Reinitialise.
    • ReInit

      public void ReInit(InputStream stream, String encoding)
      Reinitialise.
    • ReInit

      public void ReInit(Reader stream)
      Reinitialise.
      Specified by:
      ReInit in class org.apache.calcite.sql.parser.SqlAbstractParserImpl
    • ReInit

      public void ReInit(DrillParserImplTokenManager tm)
      Reinitialise.
    • getNextToken

      public final Token getNextToken()
      Get the next Token.
    • getToken

      public final Token getToken(int index)
      Get the specific Token.
    • generateParseException

      public ParseException generateParseException()
      Generate ParseException.
    • enable_tracing

      public final void enable_tracing()
      Enable tracing.
    • disable_tracing

      public final void disable_tracing()
      Disable tracing.