Package org.apache.flink.sql.parser.ddl
Class SqlTableLike
java.lang.Object
org.apache.calcite.sql.SqlNode
org.apache.calcite.sql.SqlCall
org.apache.flink.sql.parser.ddl.SqlTableLike
- All Implemented Interfaces:
Cloneable,ExtendedSqlNode
A
LIKE clause in a CREATE TABLE statement.
It enables to use an existing table descriptor to define a new, adjusted/extended table. Users
can control the way particular features of both declarations are merged using SqlTableLike.MergingStrategy and SqlTableLike.FeatureOption.
Example: A DDL like the one below for creating a `derived_table`
CREATE TABLE base_table_1 (
id BIGINT,
name STRING,
tstmp TIMESTAMP,
PRIMARY KEY(id)
) WITH (
‘connector’: ‘kafka’,
‘connector.starting-offset’: ‘12345’,
‘format’: ‘json’
)
CREATE TEMPORARY TABLE derived_table (
WATERMARK FOR tstmp AS tsmp - INTERVAL '5' SECOND
)
WITH (
‘connector.starting-offset’: ‘0’
)
LIKE base_table (
OVERWRITING OPTIONS,
EXCLUDING CONSTRAINTS
)
is equivalent to:
CREATE TEMPORARY TABLE derived_table (
id BIGINT,
name STRING,
tstmp TIMESTAMP,
WATERMARK FOR tstmp AS tsmp - INTERVAL '5' SECOND
) WITH (
‘connector’: ‘kafka’,
‘connector.starting-offset’: ‘0’,
‘format’: ‘json’
)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumA feature of a table descriptor that will be merged into the new table.static enumA strategy that describes how the features of the parent source table should be merged with the features of the newly created table.static classA pair ofSqlTableLike.MergingStrategyandSqlTableLike.FeatureOption. -
Field Summary
Fields inherited from class org.apache.calcite.sql.SqlNode
EMPTY_ARRAY, pos -
Constructor Summary
ConstructorsConstructorDescriptionSqlTableLike(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlIdentifier sourceTable, List<SqlTableLike.SqlTableLikeOption> options) -
Method Summary
Methods inherited from class org.apache.calcite.sql.SqlCall
accept, clone, equalsDeep, findValidOptions, getCallSignature, getFunctionQuantifier, getKind, getMonotonicity, isCountStar, isExpanded, operand, operandCount, setOperand, validateMethods inherited from class org.apache.calcite.sql.SqlNode
clone, clone, cloneArray, equalDeep, equalDeep, equalsDeep, getParserPosition, isA, toList, toList, toSqlString, toSqlString, toSqlString, toString, unparseWithParentheses, validateExpr
-
Constructor Details
-
SqlTableLike
public SqlTableLike(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlIdentifier sourceTable, List<SqlTableLike.SqlTableLikeOption> options)
-
-
Method Details
-
getOperator
@Nonnull public org.apache.calcite.sql.SqlOperator getOperator()- Specified by:
getOperatorin classorg.apache.calcite.sql.SqlCall
-
getOperandList
- Specified by:
getOperandListin classorg.apache.calcite.sql.SqlCall
-
getSourceTable
public org.apache.calcite.sql.SqlIdentifier getSourceTable() -
getOptions
-
validate
- Specified by:
validatein interfaceExtendedSqlNode- Throws:
SqlValidateException
-
unparse
public void unparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec) - Overrides:
unparsein classorg.apache.calcite.sql.SqlCall
-