Versions Compared

Key

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

...

Discussion thread: https://lists.apache.org/thread/39mwckdsdgck48tzsdfm66hhnxorjtz3
JIRA:

 here (<- link to Vote thread:https://issueslists.apache.org/thread/jira/browse/FLINK-XXXX)5fzfqc6dw6wyx2xsnh2rpsotsxhbpc26

JIRA:

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-32515

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

Syntax

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
languagejava
/**
 * 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.
 */
@PublicEvolving
public interface SupportsStaging {
    //.... emit the parts proposed in FLIP-305

    enum StagingPurpose {
        CREATE_TABLE_AS,
        CREATE_TABLE_AS_IF_NOT_EXISTS,
     The   // the following is what to add in this FLIP
        REPLACE_TABLE_AS,
        CREATE_OR_REPLACE_TABLE_AS
    }
}

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

...