Class SqlReplaceTableAs

  • All Implemented Interfaces:
    Cloneable, ExtendedSqlNode

    public class SqlReplaceTableAs
    extends SqlCreateTable
    implements ExtendedSqlNode
    SqlNode to 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 Detail

      • REPLACE_OPERATOR

        public static final org.apache.calcite.sql.SqlSpecialOperator REPLACE_OPERATOR
      • CREATE_OR_REPLACE_OPERATOR

        public static final org.apache.calcite.sql.SqlSpecialOperator CREATE_OR_REPLACE_OPERATOR
    • 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)