Interface StagedTable

All Superinterfaces:
Serializable

@PublicEvolving public interface StagedTable extends Serializable
The StagedTable is designed to implement Flink's atomic semantic for CTAS(CREATE TABLE AS SELECT) and RTAS([CREATE OR] REPLACE TABLE AS SELECT) statement using a two-phase commit protocol. The StagedTable is supposed to be returned via method SupportsStaging.applyStaging(org.apache.flink.table.connector.sink.abilities.SupportsStaging.StagingContext) by the DynamicTableSink which implements the SupportsStaging interface.

When the Flink job for writing to a DynamicTableSink with atomic semantic supporting is CREATED, the begin() will be called; when the Flink job is FINISHED, the commit() will be called; when the Flink job is FAILED or CANCELED, the abort() will be called;

See more in SupportsStaging.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method will be called when the job is failed or is canceled.
    void
    This method will be called when the job is started.
    void
    This method will be called when the job succeeds.
  • Method Details

    • begin

      void begin()
      This method will be called when the job is started. In Flink's atomic CTAS/RTAS scenario, it is expected to do initialization work; For example, initializing the client of the underlying service, the tmp path of the underlying storage, or even call the start transaction API of the underlying service, etc.
    • commit

      void commit()
      This method will be called when the job succeeds. In Flink's atomic CTAS/RTAS scenario, it is expected to do some commit work. For example, moving the underlying data to the target directory to make it visible, writing buffer data to the underlying storage service, or even call the commit transaction API of the underlying service, etc.
    • abort

      void abort()
      This method will be called when the job is failed or is canceled. In Flink's atomic CTAS/RTAS scenario, it is expected to do some cleaning work for writing; For example, delete the data in the tmp directory, delete the temporary data in the underlying storage service, or even call the rollback transaction API of the underlying service, etc.