public enum SqlKind extends Enum<SqlKind>
SqlNode.
The values are immutable, canonical constants, so you can use Kinds to
find particular types of expressions quickly. To identity a call to a common
operator such as '=', use SqlNode.isA(java.util.Set<org.apache.calcite.sql.SqlKind>):
exp.isA(EQUALS)
Only commonly-used nodes have their own type; other nodes are of type
OTHER. Some of the values, such as SET_QUERY, represent
aggregates.
To quickly choose between a number of options, use a switch statement:
switch (exp.getKind()) {
case EQUALS:
...;
case NOT_EQUALS:
...;
default:
throw new AssertionError("unexpected");
}
Note that we do not even have to check that a SqlNode is a
SqlCall.
To identify a category of expressions, use SqlNode.isA with
an aggregate SqlKind. The following expression will return true
for calls to '=' and '>=', but false for the constant '5', or
a call to '+':
exp.isA(SqlKind.COMPARISON)
RexNode also has a getKind method; SqlKind values are
preserved during translation from SqlNode to RexNode, where
applicable.
There is no water-tight definition of "common", but that's OK. There will
always be operators that don't have their own kind, and for these we use the
SqlOperator. But for really the common ones, e.g. the many places
where we are looking for AND, OR and EQUALS, the enum
helps.
(If we were using Scala, SqlOperator would be a case
class, and we wouldn't need SqlKind. But we're not.)
| Enum Constant and Description |
|---|
AND
The logical "AND" operator.
|
ARRAY_QUERY_CONSTRUCTOR
Array Query Constructor, e.g.
|
ARRAY_VALUE_CONSTRUCTOR
Array Value Constructor, e.g.
|
AS
AS operator
|
BETWEEN
The "BETWEEN" operator.
|
CASE
A "CASE" expression.
|
CAST
The "CAST" operator.
|
CEIL
The "CEIL" function
|
COLLECTION_TABLE
Table operator which converts user-defined transform into a relation, for
example,
select * from TABLE(udx(x, y, z)). |
COLUMN_LIST
The non-standard constructor used to pass a
COLUMN_LIST parameter to a user-defined transform.
|
CORREL_VARIABLE
Reference to correlation variable.
|
CUBE
The internal
CUBE operator that occurs within a GROUP BY
clause. |
CURRENT_VALUE
The "CURRENT VALUE OF sequence" operator.
|
CURSOR
CURSOR constructor, for example,
select * from
TABLE(udx(CURSOR(select ...), x, y, z)) |
DELETE
DELETE statement
|
DESCENDING
DESC in ORDER BY.
|
DIVIDE
The arithmetic division operator, "/".
|
DOT
Dot
|
DYNAMIC_PARAM
A dynamic parameter.
|
EQUALS
The equals operator, "=".
|
ESCAPE
Escape operator (always part of LIKE or SIMILAR TO expression).
|
EXCEPT
Except
|
EXISTS
The "EXISTS" operator.
|
EXPLAIN
EXPLAIN statement
|
EXPLICIT_TABLE
Explicit table, e.g.
|
EXTEND
The internal
EXTEND operator that qualifies a table name in the
FROM clause. |
FIELD_ACCESS
The field access operator, ".".
|
FLOOR
The "FLOOR" function
|
FOLLOWING
The "FOLLOWING" qualifier of an interval end-point in a window
specification.
|
GREATER_THAN
The greater-than operator, ">".
|
GREATER_THAN_OR_EQUAL
The greater-than-or-equal operator, ">=".
|
GROUP_ID
The internal
GROUP_ID() function. |
GROUPING
The internal
GROUPING(e) function. |
GROUPING_ID
The internal
GROUPING_ID(e, ...) function. |
GROUPING_SETS
The internal
GROUPING SETS operator that occurs within a
GROUP BY clause. |
IDENTIFIER
Identifier
|
IN
The "IN" operator.
|
INPUT_REF
Reference to an input field.
|
INSERT
INSERT statement
|
INTERSECT
Intersect
|
IS_DISTINCT_FROM
The is-distinct-from operator.
|
IS_FALSE
The "IS FALSE" operator.
|
IS_NOT_DISTINCT_FROM
The is-not-distinct-from operator.
|
IS_NOT_FALSE
The "IS NOT FALSE" operator.
|
IS_NOT_NULL
The "IS NOT NULL" operator.
|
IS_NOT_TRUE
The "IS NOT TRUE" operator.
|
IS_NULL
The "IS NULL" operator.
|
IS_TRUE
The "IS TRUE" operator.
|
IS_UNKNOWN
The "IS UNKNOWN" operator.
|
JDBC_FN
Call to a function using JDBC function syntax.
|
JOIN
JOIN operator or compound FROM clause.
|
LATERAL
The "LATERAL" qualifier to relations in the FROM clause.
|
LESS_THAN
The less-than operator, "<".
|
LESS_THAN_OR_EQUAL
The less-than-or-equal operator, "<=".
|
LIKE
The "LIKE" operator.
|
LITERAL
A literal.
|
LITERAL_CHAIN
Literal chain operator (for composite string literals).
|
LOCAL_REF
Reference to a sub-expression computed within the current relational
operator.
|
MAP_QUERY_CONSTRUCTOR
Map Query Constructor, e.g.
|
MAP_VALUE_CONSTRUCTOR
Map Value Constructor, e.g.
|
MERGE
MERGE statement
|
MINUS
The arithmetic minus operator, "-".
|
MINUS_PREFIX
The unary minus operator, as in "-1".
|
MULTISET_QUERY_CONSTRUCTOR
The MULTISET query constructor.
|
MULTISET_VALUE_CONSTRUCTOR
The MULTISET value constructor.
|
NEW_SPECIFICATION
NewSpecification
|
NEXT_VALUE
The "NEXT VALUE OF sequence" operator.
|
NOT
The logical "NOT" operator.
|
NOT_EQUALS
The not-equals operator, "!=" or "<>".
|
NULLS_FIRST
NULLS FIRST clause in ORDER BY.
|
NULLS_LAST
NULLS LAST clause in ORDER BY.
|
OR
The logical "OR" operator.
|
ORDER_BY
ORDER BY clause.
|
OTHER
Expression not covered by any other
SqlKind value. |
OTHER_FUNCTION
Function that is not a special function.
|
OVER
OVER operator
|
OVERLAPS
The "OVERLAPS" operator.
|
PLUS
The arithmetic plus operator, "+".
|
PLUS_PREFIX
The unary plus operator, as in "+1".
|
PRECEDING
The "PRECEDING" qualifier of an interval end-point in a window
specification.
|
PROCEDURE_CALL
ProcedureCall
|
REINTERPRET
The internal REINTERPRET operator (meaning a reinterpret cast).
|
ROLLUP
The internal
ROLLUP operator that occurs within a GROUP BY
clause. |
ROW
The row-constructor function.
|
SCALAR_QUERY
Scalar query; that is, a subquery used in an expression context, and
returning one row and one column.
|
SELECT
SELECT statement or sub-query.
|
SET_OPTION
"ALTER scope SET option = value" statement.
|
SIMILAR
The "SIMILAR" operator.
|
TABLESAMPLE
TABLESAMPLE operator
|
TIMES
The arithmetic multiplication operator, "*".
|
TRIM
The "TRIM" function.
|
UNION
Union
|
UNNEST
The "UNNEST" operator.
|
UPDATE
UPDATE statement
|
VALUES
The "VALUES" operator.
|
WINDOW
Window specification
|
WITH
WITH clause.
|
WITH_ITEM
Item in WITH clause.
|
| Modifier and Type | Field and Description |
|---|---|
static Set<SqlKind> |
COMPARISON
Category of comparison operators.
|
static EnumSet<SqlKind> |
DML
Category consisting of all DML operators.
|
static Set<SqlKind> |
EXPRESSION
Category consisting of all expression operators.
|
static Set<SqlKind> |
FUNCTION
Category consisting of regular and special functions.
|
static EnumSet<SqlKind> |
QUERY
Category consisting of query node types.
|
static EnumSet<SqlKind> |
SET_QUERY
Category consisting of set-query node types.
|
static Set<SqlKind> |
TOP_LEVEL
Category of all SQL statement types.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
belongsTo(Collection<SqlKind> category)
Returns whether this
SqlKind belongs to a given category. |
static SqlKind |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SqlKind[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SqlKind OTHER
SqlKind value.OTHER_FUNCTIONpublic static final SqlKind SELECT
public static final SqlKind JOIN
A FROM clause with more than one table is represented as if it were a join. For example, "FROM x, y, z" is represented as "JOIN(x, JOIN(x, y))".
public static final SqlKind IDENTIFIER
public static final SqlKind LITERAL
public static final SqlKind OTHER_FUNCTION
FUNCTIONpublic static final SqlKind EXPLAIN
public static final SqlKind INSERT
public static final SqlKind DELETE
public static final SqlKind UPDATE
public static final SqlKind SET_OPTION
public static final SqlKind DYNAMIC_PARAM
public static final SqlKind ORDER_BY
DESCENDING,
NULLS_FIRST,
NULLS_LASTpublic static final SqlKind WITH
public static final SqlKind WITH_ITEM
public static final SqlKind UNION
public static final SqlKind EXCEPT
public static final SqlKind INTERSECT
public static final SqlKind AS
public static final SqlKind OVER
public static final SqlKind WINDOW
public static final SqlKind MERGE
public static final SqlKind TABLESAMPLE
public static final SqlKind TIMES
public static final SqlKind DIVIDE
public static final SqlKind PLUS
PLUS_PREFIXpublic static final SqlKind MINUS
MINUS_PREFIXpublic static final SqlKind IN
public static final SqlKind LESS_THAN
public static final SqlKind GREATER_THAN
public static final SqlKind LESS_THAN_OR_EQUAL
public static final SqlKind GREATER_THAN_OR_EQUAL
public static final SqlKind EQUALS
public static final SqlKind NOT_EQUALS
public static final SqlKind IS_DISTINCT_FROM
public static final SqlKind IS_NOT_DISTINCT_FROM
public static final SqlKind OR
public static final SqlKind AND
public static final SqlKind DOT
public static final SqlKind OVERLAPS
public static final SqlKind LIKE
public static final SqlKind SIMILAR
public static final SqlKind BETWEEN
public static final SqlKind CASE
public static final SqlKind NOT
public static final SqlKind PLUS_PREFIX
PLUSpublic static final SqlKind MINUS_PREFIX
MINUSpublic static final SqlKind EXISTS
public static final SqlKind VALUES
public static final SqlKind EXPLICIT_TABLE
public static final SqlKind SCALAR_QUERY
public static final SqlKind PROCEDURE_CALL
public static final SqlKind NEW_SPECIFICATION
public static final SqlKind DESCENDING
public static final SqlKind NULLS_FIRST
public static final SqlKind NULLS_LAST
public static final SqlKind IS_TRUE
public static final SqlKind IS_FALSE
public static final SqlKind IS_NOT_TRUE
public static final SqlKind IS_NOT_FALSE
public static final SqlKind IS_UNKNOWN
public static final SqlKind IS_NULL
public static final SqlKind IS_NOT_NULL
public static final SqlKind PRECEDING
public static final SqlKind FOLLOWING
public static final SqlKind FIELD_ACCESS
(Only used at the RexNode level; at SqlNode level, a field-access is part of an identifier.)
public static final SqlKind INPUT_REF
(Only used at the RexNode level.)
public static final SqlKind LOCAL_REF
(Only used at the RexNode level.)
public static final SqlKind CORREL_VARIABLE
(Only used at the RexNode level.)
public static final SqlKind ROW
VALUES 1, ROW (2).public static final SqlKind COLUMN_LIST
public static final SqlKind CAST
public static final SqlKind NEXT_VALUE
public static final SqlKind CURRENT_VALUE
public static final SqlKind FLOOR
public static final SqlKind CEIL
public static final SqlKind TRIM
public static final SqlKind JDBC_FN
public static final SqlKind MULTISET_VALUE_CONSTRUCTOR
public static final SqlKind MULTISET_QUERY_CONSTRUCTOR
public static final SqlKind UNNEST
public static final SqlKind LATERAL
public static final SqlKind COLLECTION_TABLE
select * from TABLE(udx(x, y, z)). See also the
EXPLICIT_TABLE prefix operator.public static final SqlKind ARRAY_VALUE_CONSTRUCTOR
Array[1, 2, 3].public static final SqlKind ARRAY_QUERY_CONSTRUCTOR
Array(select deptno from dept).public static final SqlKind MAP_VALUE_CONSTRUCTOR
Map['washington', 1, 'obama', 44].public static final SqlKind MAP_QUERY_CONSTRUCTOR
MAP (SELECT empno, deptno FROM emp).public static final SqlKind CURSOR
select * from
TABLE(udx(CURSOR(select ...), x, y, z))public static final SqlKind LITERAL_CHAIN
public static final SqlKind ESCAPE
public static final SqlKind REINTERPRET
public static final SqlKind EXTEND
EXTEND operator that qualifies a table name in the
FROM clause.public static final SqlKind CUBE
CUBE operator that occurs within a GROUP BY
clause.public static final SqlKind ROLLUP
ROLLUP operator that occurs within a GROUP BY
clause.public static final SqlKind GROUPING_SETS
GROUPING SETS operator that occurs within a
GROUP BY clause.public static final SqlKind GROUPING
GROUPING(e) function.public static final SqlKind GROUPING_ID
GROUPING_ID(e, ...) function.public static final SqlKind GROUP_ID
GROUP_ID() function.public static final Set<SqlKind> EXPRESSION
A node is an expression if it is NOT one of the following:
AS,
DESCENDING,
SELECT,
JOIN,
OTHER_FUNCTION,
CAST,
TRIM,
LITERAL_CHAIN,
JDBC_FN,
PRECEDING,
FOLLOWING,
ORDER_BY,
COLLECTION_TABLE,
TABLESAMPLE.
public static final EnumSet<SqlKind> DML
Consists of:
INSERT,
UPDATE,
DELETE,
MERGE,
PROCEDURE_CALL.
NOTE jvs 1-June-2006: For now we treat procedure calls as DML; this makes it easy for JDBC clients to call execute or executeUpdate and not have to process dummy cursor results. If in the future we support procedures which return results sets, we'll need to refine this.
public static final Set<SqlKind> FUNCTION
Consists of regular functions OTHER_FUNCTION and special
functions ROW, TRIM, CAST, JDBC_FN.
public static final Set<SqlKind> COMPARISON
Consists of:
IN,
EQUALS,
NOT_EQUALS,
LESS_THAN,
GREATER_THAN,
LESS_THAN_OR_EQUAL,
GREATER_THAN_OR_EQUAL.
public static SqlKind[] values()
for (SqlKind c : SqlKind.values()) System.out.println(c);
public static SqlKind valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant
with the specified nameNullPointerException - if the argument is nullpublic final boolean belongsTo(Collection<SqlKind> category)
SqlKind belongs to a given category.
A category is a collection of kinds, not necessarily disjoint. For example, QUERY is { SELECT, UNION, INTERSECT, EXCEPT, VALUES, ORDER_BY, EXPLICIT_TABLE }.
category - CategoryCopyright © 2012–2015 The Apache Software Foundation. All rights reserved.