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
public class SqlTableLike extends org.apache.calcite.sql.SqlCall implements ExtendedSqlNode
ALIKEclause in aCREATE TABLEstatement.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.MergingStrategyandSqlTableLike.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 Classes Modifier and Type Class Description static classSqlTableLike.FeatureOptionA feature of a table descriptor that will be merged into the new table.static classSqlTableLike.MergingStrategyA strategy that describes how the features of the parent source table should be merged with the features of the newly created table.static classSqlTableLike.SqlTableLikeOptionA pair ofSqlTableLike.MergingStrategyandSqlTableLike.FeatureOption.
-
Constructor Summary
Constructors Constructor Description SqlTableLike(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlIdentifier sourceTable, List<SqlTableLike.SqlTableLikeOption> options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<org.apache.calcite.sql.SqlNode>getOperandList()org.apache.calcite.sql.SqlOperatorgetOperator()List<SqlTableLike.SqlTableLikeOption>getOptions()org.apache.calcite.sql.SqlIdentifiergetSourceTable()voidunparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec)voidvalidate()-
Methods inherited from class org.apache.calcite.sql.SqlCall
accept, clone, equalsDeep, findValidOptions, getCallSignature, getFunctionQuantifier, getKind, getMonotonicity, isCountStar, isExpanded, operand, operandCount, setOperand, validate
-
-
-
-
Constructor Detail
-
SqlTableLike
public SqlTableLike(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlIdentifier sourceTable, List<SqlTableLike.SqlTableLikeOption> options)
-
-
Method Detail
-
getOperator
@Nonnull public org.apache.calcite.sql.SqlOperator getOperator()
- Specified by:
getOperatorin classorg.apache.calcite.sql.SqlCall
-
getOperandList
@Nonnull public List<org.apache.calcite.sql.SqlNode> getOperandList()
- Specified by:
getOperandListin classorg.apache.calcite.sql.SqlCall
-
getSourceTable
public org.apache.calcite.sql.SqlIdentifier getSourceTable()
-
getOptions
public List<SqlTableLike.SqlTableLikeOption> getOptions()
-
validate
public void validate() throws SqlValidateException- 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
-
-