Versions Compared

Key

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

@PublicEvolving
public interface Catalog {

Page properties

Document the state by adding a label to the FLIP page with one of "discussion", "accepted", "released", "rejected".

Discussion threadhere (<- link to https://lists.apache.org/list.html?dev@flink.apache.org)
Vote threadhere (<- link to https://lists.apache.org/list.html?dev@flink.apache.org)
JIRAhere (<- link to https://issues.apache.org/jira/browse/FLINK-XXXX)
Release<Flink Version>


...

Code Block
languagesql
SELECT * FROM paimon_tb AS OF TIMESTAMP '2023-04-27 00:00:00'


Public interfaces

...

Catalog

Code Block
languagejava
@PublicEvolving
public interface Catalog {

   /**
 Enables to push down the* timestampReturns ofa snapshot{@link intoCatalogTable} aor {@link ScanTableSource}.
 *
CatalogView} identified by the given {@link
     * <p>WhenObjectPath}. aThe sourceframework connectorwill implementsresolve the SupportsTimeTravel interface, users can leverage its
 * time-travel functionality to analyze historical data, perform backfilling operations, and more.
 * This can be particularly useful for debugging and data recovery purposes.
 */

@PublicEvolving
public interface SupportsTimeTravel {

    /** metadata objects when necessary.
     *
     * @param tablePath Path of the table or view
     * @param timestamp Timestamp of the table snapshot
     * @return The requested table or view
     * @throws TableNotExistException if the target does not exist
     * @param@throws timestampCatalogException Thein timestampcase of theany snapshot to apply.runtime exception
     */
    default voidCatalogBaseTable applySnapshotgetTable(ObjectPath tablePath, long timestamp)
            throws TableNotExistException, CatalogException {
        throw new UnsupportedOperationException(
                String.format("Table %s does not support time travel.", tablePath));
    }

}



Proposed Changes

...

...


Compatibility, Deprecation, and Migration Plan

...

Code Block
languagesql
SELECT ENo,EName,Sys_Start,Sys_End
FROM Emp FOR SYSTEM_TIME BETWEEN
 TIMESTAMP '2011-01-02 00:00:00'AND
 TIMESTAMP '2011-12-31 00:00:00' 



Rejected Alternatives

...

Add SupportsTimeTravel source ability  

Add a new source ability interface. Different connectors can implement this interfaces to support time travel.

1. Add the Source Ability interface to support TimeTravel systems in implementing TimeTravel capabilities.
2. Add corresponding table optimization rules so that during LogicalPlan optimization, the Snapshot interval can be pushed up to the ScanTableSource.
3. To avoid conflicts with Temporal Join, we should apply TimeTravel transformation rules before apply the Temporal Join transformation rules.

Code Block
languagejava
/**
 Enables to push down the timestamp of snapshot into a {@link ScanTableSource}.
 *
 * <p>When a source connector implements the SupportsTimeTravel interface, users can leverage its
 * time-travel functionality to analyze historical data, perform backfilling operations, and more.
 * This can be particularly useful for debugging and data recovery purposes.
 */

@PublicEvolving
public interface SupportsTimeTravel {

    /**
     * @param timestamp The timestamp of the snapshot to apply.
     */
    void applySnapshot(long timestamp);
}