Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Discussion thread:

 here (<- link to Vote thread:


serverASF JIRA

Released: <Flink Version>


In FLIP-218 & FLIP-305, Flink support supports CREATE TABLE AS SELECT  statement which allows users to create new tables based on existing tables or query resultresults. It's convenient for data analysts and data scientists to manage their data. However, Flink does not currently support the REPLACE TABLE AS SELECT  statment statement which enables users to replace an existing table with new data. With REPLACE TABLE AS SELECT, they won't need to drop the table firstly, first and use CREATE TABLE AS SELECT  then. Only one single REPLACE TABLE AS SELCTSELECT  statement can meet their needs.

So, this FLIP is aimed to support REPLACE TABLE AS SELECT  statement in Flink.

Note: this FLIP is much similiar similar to FLIP-218 & FLIP-305, you may need to read these two FLIP to get more context.

Public Interfaces


We propose add adding the following syntax for REPLACE TABLE AS SELECT  statement:


Also, we would like to propose to CREATE OR REPLACE TABLE AS  to wrap CREATE TABLE AS SELECT  and REPLACE TABLE AS SELECT  which will create a table if the table to be replaced doesn't exist.


Code Block
 * Enables different staged operations to ensure atomicity in a {@link DynamicTableSink}.
 * <p>By default, if this interface is not implemented, indicating that atomic operations are not
 * supported, then a non-atomic implementation is used.
public interface SupportsStaging {
    //.... emit the parts proposed in FLIP-305

    enum StagingPurpose {
     The   // the following is what to add in this FLIP

Also, we propose to modify the name of the option "table.ctascats.atomicity-enabled" proposed in FLIP-305: