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:
SqlLiteral
represents a boolean, numeric, string, or date constant, or the valueNULL
.SqlIdentifier
represents an identifier, such asEMPNO
oremp.deptno
.SqlCall
is 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, aselect
statement is a call to the 'select' operator.SqlNodeList
is 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 SqlNode
s 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
SqlNode
s into a SQL string. A
SqlDialect
defines how this happens.
-
ClassDescription
ExplicitOperatorBinding
implementsSqlOperatorBinding
via 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.Parse tree node representing aASOF JOIN
clause.Describes the syntax of the SQL ASOF JOIN operator.TheAS
operator associates an expression with an alias.Implementation ofSqlCall
that keeps its operands in an array.Concrete implementation ofSqlFunction
.A sql type name specification of basic sql type.SqlBinaryOperator
is a binary operator.A binary (or hexadecimal) string literal.ASqlCall
is a call to anoperator
.SqlCallBinding
implementsSqlOperatorBinding
by analyzing to the operands of aSqlCall
with aSqlValidator
.A character string literal.ASqlCollation
is an object representing aCollate
statement.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.ASqlDelete
is a node of a parse tree which represents a DELETE statement.ASqlDescribeSchema
is a node of a parse tree that represents aDESCRIBE SCHEMA
statement.ASqlDescribeTable
is a node of a parse tree that represents aDESCRIBE TABLE
statement.DESCRIPTOR appears as an argument in a function.SqlDialect
encapsulates 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 aSqlDialect
appropriate for a given database metadata object.The default implementation of aSqlDialectFactory
.Utilities related toSqlDialect
.Base class for an DROP statements parse tree nodes.ASqlDynamicParam
represents a dynamic parameter marker in an SQL statement.ASqlExplain
is 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 PLAN
statement.SqlExplainLevel defines detail levels for EXPLAIN PLAN.An operator that applies a filter before rows are included in an aggregate function.ASqlFunction
is 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.ASqlHint
is a node of a parse tree which represents a sql hint expression.Enumeration that represents hint option format.SqlHopTableFunction implements an operator for hopping.ASqlIdentifier
is an identifier, possibly compound.A generalization of a binary operator to involve several (two or more) arguments, and keywords between each pair of arguments.ASqlInsert
is 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.ASqlJdbcFunctionCall
is 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 aJOIN
clause.Describes the syntax of the SQLJOIN
operator.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
.ASqlLambda
is a node of a parse tree which represents a lambda expression.An operator describing a LATERAL specification.ASqlLiteral
is 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 MATCH
clause.Options forROWS PER MATCH
.An operator describing a MATCH_RECOGNIZE specification.TheMEASURE
wraps an expression in theSELECT
clause and tags it as a measure.ASqlMerge
is a node of a parse tree which represents a MERGE statement.ASqlNode
is a SQL parse tree.ASqlNodeList
is a list ofSqlNode
s.SqlNullSemantics defines the possible comparison rules for values which might be null.An operator that decides how to handle null input (RESPECT NULLS
andIGNORE NULLS
).A numeric SQL literal.A class that describes how many operands an operator can take.ASqlOperator
is a type of node in a SQL parse tree (it is NOT a node in a SQL parse tree).SqlOperatorBinding
represents the binding of anSqlOperator
to 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 BY
on 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.ASqlSelect
is 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 representSET
andRESET
statements, optionally preceded byALTER SYSTEM
orALTER 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 ofSqlSpatialTypeOperatorTable
containing 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 forSUM
andSUM0
functions.Splitting strategy forCOUNT
.Collection in which one can register an element.Aggregate function that splits into two applications of itself.Splitting strategy forSUM0
function.Splitting strategy forSUM
function.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.ASqlTableRef
is 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.ASqlTypeNameSpec
is a type name specification that allows user to customize sql node unparsing and data type deriving.Literal whose type is not yet known.TheUNNEST
operator.Parse tree node that represents UNPIVOT applied to a table reference (or sub-query).Placeholder for an unresolved function.ASqlUpdate
is 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 particularDatabaseMetaData
methods; invocations of other methods will fall through to the base class,BarfingInvocationHandler
, which will throw an error.TheVALUES
operator.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.ASqlWriter
is 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 forSqlWriter
andSqlPrettyWriter
.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