...
We propose add the following syntax for time travel statement. In the SQL 2011 standard[1], syntax related to Time Travel is defined.
Query the data for a past moment.
Code Block |
---|
|
-- Specify a specific time
SELECT * FROM paimon_tb FOR SYSTEM_TIME AS OF TIMESTAMP '2023-04-27 00:00:00'
-- Specify a constant expression
SELECT * FROM paimon_tb FOR SYSTEM_TIME AS OF TIMESTAMP '2023-04-27 00:00:00' - INTERVAL '1' DAY |
Query the data for the current moment
Code Block |
---|
-- By default, if no time is specified, the system will query data from the latest timestamp.
SELECT * FROM paimon_tb;
-- Specify a current-time expression
SELECT * FROM paimon_tb FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP; |
Public interfaces
Catalog
Code Block |
---|
|
@PublicEvolving
public interface Catalog {
/**
* Returns a {@link CatalogTable} or {@link CatalogView} identified by the given {@link
* ObjectPath}. The framework will resolve the 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
* @throws CatalogException in case of any runtime exception
*/
default CatalogBaseTable getTable(ObjectPath tablePath, long timestamp)
throws TableNotExistException, CatalogException {
throw new UnsupportedOperationException(
String.format("Table %s does not support time travel.", tablePath));
}
} |
...