Package org.apache.flink.table.catalog
Interface StagedTable
-
- All Superinterfaces:
Serializable
@PublicEvolving public interface StagedTable extends Serializable
TheStagedTable
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. TheStagedTable
is supposed to be returned via methodSupportsStaging.applyStaging(org.apache.flink.table.connector.sink.abilities.SupportsStaging.StagingContext)
by theDynamicTableSink
which implements theSupportsStaging
interface.When the Flink job for writing to a
DynamicTableSink
with atomic semantic supporting is CREATED, thebegin()
will be called; when the Flink job is FINISHED, thecommit()
will be called; when the Flink job is FAILED or CANCELED, theabort()
will be called;See more in
SupportsStaging
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
abort()
This method will be called when the job is failed or is canceled.void
begin()
This method will be called when the job is started.void
commit()
This method will be called when the job succeeds.
-
-
-
Method Detail
-
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.
-
-