Interface SupportsStaging


@PublicEvolving public interface SupportsStaging
Interface for DynamicTableSinks that support atomic semantic for CTAS(CREATE TABLE AS SELECT) or RTAS([CREATE OR] REPLACE TABLE AS SELECT) statement using a two-phase commit protocol. The table sink is responsible for returning a StagedTable to tell the Flink how to implement the atomicity semantics.

If the user turns on TableConfigOptions#TABLE_RTAS_CTAS_ATOMICITY_ENABLED, and the DynamicTableSink implements SupportsStaging, the planner will call method applyStaging(StagingContext) to get the StagedTable returned by the sink, then the StagedTable will be used by Flink to implement a two-phase commit with the actual implementation of the StagedTable.

  • Method Details

    • applyStaging

      Provides a SupportsStaging.StagingContext for the sink modification and return a StagedTable. The StagedTable provides transaction abstraction to support atomicity for CTAS/RTAS. Flink will call the relevant API of StagedTable when the Job status switches,

      Note: This method will be called at the compile stage.

      Parameters:
      context - The context for the sink modification
      Returns:
      StagedTable that will be leveraged by Flink framework to provide atomicity semantics.