Package org.apache.flink.sql.parser.ddl
Class SqlReplaceTableAs
- java.lang.Object
-
- org.apache.calcite.sql.SqlNode
-
- org.apache.calcite.sql.SqlCall
-
- org.apache.calcite.sql.SqlDdl
-
- org.apache.calcite.sql.SqlCreate
-
- org.apache.flink.sql.parser.ddl.SqlReplaceTableAs
-
- All Implemented Interfaces:
Cloneable,ExtendedSqlNode
public class SqlReplaceTableAs extends org.apache.calcite.sql.SqlCreate implements ExtendedSqlNode
SqlNodeto describe the [CREATE OR] REPLACE TABLE AS (RTAS) syntax. The RTAS would create a pipeline to compute the result of the given query and create or replace the derived table.Notes: REPLACE TABLE AS: the derived table must exist. CREATE OR REPLACE TABLE AS: create the derived table if it does not exist, otherwise replace it.
Example:
CREATE TABLE base_table ( id BIGINT, name STRING, time TIMESTAMP, PRIMARY KEY(id) ) WITH ( ‘connector’ = ‘kafka’, ‘connector.starting-offset’: ‘12345’, ‘format’ = ‘json’ ) CREATE OR REPLACE TABLE derived_table WITH ( 'connector' = 'jdbc', 'url' = 'http://localhost:10000', 'table-name' = 'syncedTable' ) AS SELECT * FROM base_table;
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.calcite.sql.SqlSpecialOperatorCREATE_OR_REPLACE_OPERATORstatic org.apache.calcite.sql.SqlSpecialOperatorREPLACE_OPERATOR
-
Constructor Summary
Constructors Constructor Description SqlReplaceTableAs(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlIdentifier tableName, org.apache.calcite.sql.SqlNodeList columnList, List<SqlTableConstraint> tableConstraints, org.apache.calcite.sql.SqlNodeList propertyList, SqlDistribution distribution, org.apache.calcite.sql.SqlNodeList partitionKeyList, SqlWatermark watermark, org.apache.calcite.sql.SqlCharStringLiteral comment, org.apache.calcite.sql.SqlNode asQuery, boolean isTemporary, boolean ifNotExists, boolean isCreateOrReplace)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]fullTableName()org.apache.calcite.sql.SqlNodegetAsQuery()org.apache.calcite.sql.SqlNodeListgetColumnList()Optional<org.apache.calcite.sql.SqlCharStringLiteral>getComment()SqlDistributiongetDistribution()List<SqlTableConstraint>getFullConstraints()Returns the column constraints plus the table constraints.List<org.apache.calcite.sql.SqlNode>getOperandList()org.apache.calcite.sql.SqlNodeListgetPartitionKeyList()org.apache.calcite.sql.SqlNodeListgetPropertyList()List<SqlTableConstraint>getTableConstraints()org.apache.calcite.sql.SqlIdentifiergetTableName()Optional<SqlWatermark>getWatermark()booleanisCreateOrReplace()booleanisIfNotExists()booleanisSchemaWithColumnsIdentifiersOnly()booleanisTemporary()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
-
SqlReplaceTableAs
public SqlReplaceTableAs(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlIdentifier tableName, org.apache.calcite.sql.SqlNodeList columnList, List<SqlTableConstraint> tableConstraints, org.apache.calcite.sql.SqlNodeList propertyList, SqlDistribution distribution, org.apache.calcite.sql.SqlNodeList partitionKeyList, @Nullable SqlWatermark watermark, @Nullable org.apache.calcite.sql.SqlCharStringLiteral comment, org.apache.calcite.sql.SqlNode asQuery, boolean isTemporary, boolean ifNotExists, boolean isCreateOrReplace)
-
-
Method Detail
-
getDistribution
public SqlDistribution getDistribution()
-
getOperandList
@Nonnull public List<org.apache.calcite.sql.SqlNode> getOperandList()
- Specified by:
getOperandListin classorg.apache.calcite.sql.SqlCall
-
validate
public void validate() throws SqlValidateException- Specified by:
validatein interfaceExtendedSqlNode- Throws:
SqlValidateException
-
getAsQuery
public org.apache.calcite.sql.SqlNode getAsQuery()
-
isCreateOrReplace
public boolean isCreateOrReplace()
-
getTableName
public org.apache.calcite.sql.SqlIdentifier getTableName()
-
getColumnList
public org.apache.calcite.sql.SqlNodeList getColumnList()
-
getPropertyList
public org.apache.calcite.sql.SqlNodeList getPropertyList()
-
getPartitionKeyList
public org.apache.calcite.sql.SqlNodeList getPartitionKeyList()
-
getTableConstraints
public List<SqlTableConstraint> getTableConstraints()
-
getWatermark
public Optional<SqlWatermark> getWatermark()
-
getComment
public Optional<org.apache.calcite.sql.SqlCharStringLiteral> getComment()
-
isIfNotExists
public boolean isIfNotExists()
-
isTemporary
public boolean isTemporary()
-
isSchemaWithColumnsIdentifiersOnly
public boolean isSchemaWithColumnsIdentifiersOnly()
-
getFullConstraints
public List<SqlTableConstraint> getFullConstraints()
Returns the column constraints plus the table constraints.
-
unparse
public void unparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec)- Overrides:
unparsein classorg.apache.calcite.sql.SqlCall
-
fullTableName
public String[] fullTableName()
-
-