Package org.apache.calcite.sql
This package, and the dependent org.apache.calcite.sql.parser
package, are independent of the other Calcite packages, so may be used
standalone.
Parser
SqlParser parses a SQL string to a
parse tree. It only performs the most basic syntactic validation.
Object model
Every node in the parse tree is a SqlNode.
Sub-types are:
SqlLiteralrepresents a boolean, numeric, string, or date constant, or the valueNULL.SqlIdentifierrepresents an identifier, such asEMPNOoremp.deptno.SqlCallis a call to an operator or function. By means of special operators, we can use this construct to represent virtually every non-leaf node in the tree. For example, aselectstatement is a call to the 'select' operator.SqlNodeListis a list of nodes.
A SqlOperator describes the behavior of a
node in the tree, such as how to un-parse a
SqlCall into a SQL string. It is
important to note that operators are metadata, not data: there is only
one SqlOperator instance representing the '=' operator, even
though there may be many calls to it.
SqlOperator has several derived classes which make it easy to
define new operators: SqlFunction,
SqlBinaryOperator,
SqlPrefixOperator,
SqlPostfixOperator.
And there are singleton classes for special syntactic constructs
SqlSelectOperator
and SqlJoin.SqlJoinOperator. (These
special operators even have their own sub-types of
SqlCall:
SqlSelect and
SqlJoin.)
A SqlOperatorTable is a collection of
operators. By supplying your own operator table, you can customize the
dialect of SQL without modifying the parser.
Validation
SqlValidator checks that
a tree of SqlNodes is
semantically valid. You supply a
SqlOperatorTable to describe the available
functions and operators, and a
SqlValidatorCatalogReader for
access to the database's catalog.
Generating SQL
A SqlWriter converts a tree of
SqlNodes into a SQL string. A
SqlDialect defines how this happens.
-
ClassDescription
ExplicitOperatorBindingimplementsSqlOperatorBindingvia an underlying array of known operand types.Enumerates the types of condition in a join expression.Enumerates the types of join.A SQL literal representing a DATE, TIME or TIMESTAMP value.Access type.SqlAccessType is represented by a set of allowed access types.Abstract base class for the definition of an aggregate function: an operator which aggregates sets of values into a result.Represents a type name for an alien system.Base class for an ALTER statements parse tree nodes.A SqlArrayWithAngleBracketsNameSpec to parse or unparse SQL ARRAY type toARRAY<VARCHAR>.Parse tree node representing aASOF JOINclause.Describes the syntax of the SQL ASOF JOIN operator.TheASoperator associates an expression with an alias.Implementation ofSqlCallthat keeps its operands in an array.Concrete implementation ofSqlFunction.A sql type name specification of basic sql type.SqlBinaryOperatoris a binary operator.A binary (or hexadecimal) string literal.ASqlCallis a call to anoperator.SqlCallBindingimplementsSqlOperatorBindingby analyzing to the operands of aSqlCallwith aSqlValidator.A character string literal.ASqlCollationis an object representing aCollatestatement.A <character value expression> consisting of a column reference has the coercibility characteristic Implicit, with collating sequence as defined when the column was created.A sql type name specification of collection type.Base class for an CREATE statements parse tree nodes.Represents a SQL data type specification in a parse tree.A SQL literal representing a DATE value, such asDATE '2004-10-22'.Base class for CREATE, DROP and other DDL statements.ASqlDeleteis a node of a parse tree which represents a DELETE statement.ASqlDescribeSchemais a node of a parse tree that represents aDESCRIBE SCHEMAstatement.ASqlDescribeTableis a node of a parse tree that represents aDESCRIBE TABLEstatement.DESCRIPTOR appears as an argument in a function.SqlDialectencapsulates the differences between dialects of SQL.Whether this JDBC driver needs you to pass a Calendar object to methods such asResultSet.getTimestamp(int, java.util.Calendar).Information for creating a dialect.Rough list of flavors of database.Deprecated.Creates aSqlDialectappropriate for a given database metadata object.The default implementation of aSqlDialectFactory.Utilities related toSqlDialect.Base class for an DROP statements parse tree nodes.ASqlDynamicParamrepresents a dynamic parameter marker in an SQL statement.ASqlExplainis a node of a parse tree which represents an EXPLAIN PLAN statement.The level of abstraction with which to display the plan.Output format forEXPLAIN PLANstatement.SqlExplainLevel defines detail levels for EXPLAIN PLAN.An operator that applies a filter before rows are included in an aggregate function.ASqlFunctionis a type of operator which has conventional function-call syntax.SqlFunctionalOperator is a base class for special operators which use functional syntax.Enumeration of the categories of SQL-invoked routines.SQL function that computes keys by which rows can be partitioned and aggregated.ASqlHintis a node of a parse tree which represents a sql hint expression.Enumeration that represents hint option format.SqlHopTableFunction implements an operator for hopping.ASqlIdentifieris an identifier, possibly compound.A generalization of a binary operator to involve several (two or more) arguments, and keywords between each pair of arguments.ASqlInsertis a node of a parse tree which represents an INSERT statement.Defines the keywords that can occur immediately after the "INSERT" keyword.Generic operator for nodes with internal syntax.A SQL literal representing a time interval.A Interval value.Represents an INTERVAL qualifier.Defines the name of the types which can occur as a type argument in a JDBC{fn CONVERT(value, type)}function.ASqlJdbcFunctionCallis a node of a parse tree which represents a JDBC function call.Converter that calls a built-in function with the same arguments.Parse tree node representing aJOINclause.Describes the syntax of the SQLJOINoperator.Indicating how JSON constructors handle null.Flag to indicate if the json value is missing or an error is thrown where EmptyOrErrorBehavior is invoked.Supported json encodings that could be passed to aJsonValueExpression.Categorizing Json exists error behaviors.Categorizing Json query empty or error behaviors.How json query function handle array result.Categorizing Json value empty or error behaviors.Flag to indicate the explicit return type of JSON_VALUE.Enumerates the possible types ofSqlNode.ASqlLambdais a node of a parse tree which represents a lambda expression.An operator describing a LATERAL specification.ASqlLiteralis a constant.Deprecated.Parse SQL MAP type, i.e.Base class for all functions used in MATCH_RECOGNIZE.SqlNode for MATCH_RECOGNIZE clause.Options forAFTER MATCHclause.Options forROWS PER MATCH.An operator describing a MATCH_RECOGNIZE specification.TheMEASUREwraps an expression in theSELECTclause and tags it as a measure.ASqlMergeis a node of a parse tree which represents a MERGE statement.ASqlNodeis a SQL parse tree.ASqlNodeListis a list ofSqlNodes.SqlNullSemantics defines the possible comparison rules for values which might be null.An operator that decides how to handle null input (RESPECT NULLSandIGNORE NULLS).A numeric SQL literal.A class that describes how many operands an operator can take.ASqlOperatoris a type of node in a SQL parse tree (it is NOT a node in a SQL parse tree).SqlOperatorBindingrepresents the binding of anSqlOperatorto actual operands, along with any additional information required to validate those operands if needed.SqlOperatorTable defines a directory interface for enumerating and looking up SQL operators and functions.Parse tree node that represents anORDER BYon a query other than aSELECT(e.g.An operator describing a window function specification.Parse tree node that represents a PIVOT applied to a table reference (or sub-query).A postfix unary operator.A unary operator.SqlProcedureCallOperator represents the CALL statement.Operator which aggregates sets of values into a result.A sql type name specification of row type.Specification of a SQL sample.Sample specification that orders substitution.Sample specification.ASqlSelectis a node of a parse tree which represents a select statement.Defines the keywords which can occur immediately after the "SELECT" keyword.An operator describing a query.SqlSessionTableFunction implements an operator for per-key sessionization.SqlSetOperator represents a relational set theory operator (UNION, INTERSECT, MINUS).SQL parse tree node to representSETandRESETstatements, optionally preceded byALTER SYSTEMorALTER SESSION.SetSemanticsTable appears as an parameter in a table function.Aggregate function that knows how to convert itself to a scalar value when applied to a single row.Parse tree node for "FOR SYSTEM_TIME AS OF" temporal clause.An operator describing a FOR SYSTEM_TIME specification.Implementation ofSqlSpatialTypeOperatorTablecontaining the spatial operators and functions.Generic operator for nodes with special syntax.List of tokens: the input to a parser.Aggregate function that can be split into partial aggregates.Common splitting strategy forSUMandSUM0functions.Splitting strategy forCOUNT.Collection in which one can register an element.Aggregate function that splits into two applications of itself.Splitting strategy forSUM0function.Splitting strategy forSUMfunction.Deprecated.Aggregate function whose value may be a constant expression, based on only the contents of the GROUP BY clause.Enumeration of possible syntactic types ofoperators.A function that returns a table.ASqlTableRefis a node of a parse tree which represents a table reference.A SQL literal representing a TIME value, for exampleTIME '14:33:44.567'.A SQL literal representing a TIMESTAMP value, for exampleTIMESTAMP '1969-07-21 03:15'.A SQL literal representing a TIMESTAMP WITH TIME ZONE value, for exampleTIMESTAMP '1969-07-21 03:15 GMT+00:00'.A SQL literal representing a TIME WITH TIME ZONE value, for exampleTIME WITH TIME ZONE '14:33:44.567 GMT+08'.Base class for an TRUNCATE statements parse tree nodes.SqlTumbleTableFunction implements an operator for tumbling.Type Constructor function.ASqlTypeNameSpecis a type name specification that allows user to customize sql node unparsing and data type deriving.Literal whose type is not yet known.TheUNNESToperator.Parse tree node that represents UNPIVOT applied to a table reference (or sub-query).Placeholder for an unresolved function.ASqlUpdateis a node of a parse tree which represents an UPDATE statement.A sql type name specification of user defined type.Contains utility functions related to SQL parsing, all static.Handles particularDatabaseMetaDatamethods; invocations of other methods will fall through to the base class,BarfingInvocationHandler, which will throw an error.A SQL literal representing an UUID value, for exampleUUID '123e4567-e89b-12d3-a456-426655440000'.TheVALUESoperator.SQL window specification.Base class for a table-valued function that computes windows.Partial implementation of operand type checker.The WITH clause of a query.An operator that applies a distinct operation before rows are included in an aggregate function.An operator that applies a sort operation before rows are included in an aggregate function.Used for PERCENTILE_DISC return type inference.An item in a WITH clause of a query.ASqlWriteris the target to construct a SQL statement from a parse tree.A Frame is a piece of generated text which shares a common indentation level.Frame type.Enumerates the types of frame.Style of formatting sub-queries.Configuration forSqlWriterandSqlPrettyWriter.Policy for how to do deal with long lines.Sub-class should be a Enum and can convert to aSqlLiteral.A table-valued input parameter of a table function is classified by three characteristics.Builder forTableCharacteristic.Input table has either row semantics or set semantics.
org.apache.calcite.avatica.SqlState