mirror of
https://github.com/apache/impala.git
synced 2026-02-02 06:00:36 -05:00
Iceberg table modifications cause new table snapshots to be created;
these snapshots represent an earlier version of the table. The Iceberg
API provides a way to rollback the table to a previous snapshot.
This change adds the ability to execute a rollback on Iceberg tables
using the following statements:
- ALTER TABLE <tbl> EXECUTE ROLLBACK(<snapshot id>)
- ALTER TABLE <tbl> EXECUTE ROLLBACK('<timestamp>')
The latter form of the command rolls back to the most recent snapshot
that has a creation timestamp that is older than the specified
timestamp.
Note that when a table is rolled back to a snapshot, a new snapshot is
created with the same snapshot id, but with a new creation timestamp.
Testing:
- Added analysis unit tests.
- Added e2e tests.
- Converted test_time_travel to use get_snapshots() from iceberg_util.
- Add a utility class to allow pytests to create tables with various
iceberg catalogs.
Change-Id: Ic74913d3b81103949ffb5eef7cc936303494f8b9
Reviewed-on: http://gerrit.cloudera.org:8080/19002
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
27 lines
1.0 KiB
Plaintext
27 lines
1.0 KiB
Plaintext
====
|
|
---- QUERY
|
|
# EXECUTE ROLLBACK with an invalid snapshot id on a partitioned Iceberg table.
|
|
ALTER TABLE functional_parquet.iceberg_partitioned EXECUTE ROLLBACK(1)
|
|
---- CATCH
|
|
Cannot roll back to unknown snapshot id: 1
|
|
====
|
|
---- QUERY
|
|
# EXECUTE ROLLBACK to a too old date on a partitioned Iceberg table.
|
|
set timezone=CET;
|
|
ALTER TABLE functional_parquet.iceberg_partitioned EXECUTE ROLLBACK('2020-08-31 07:58:00')
|
|
---- CATCH
|
|
Cannot roll back, no valid snapshot older than: 1598853480000
|
|
====
|
|
---- QUERY
|
|
# EXECUTE ROLLBACK to an Invalid timestamp expression on a partitioned Iceberg table.
|
|
set timezone=CET;
|
|
ALTER TABLE functional_parquet.iceberg_partitioned EXECUTE ROLLBACK('1111');
|
|
---- CATCH
|
|
An invalid TIMESTAMP expression has been given to EXECUTE ROLLBACK(<expression>): the expression '1111' cannot be converted to a TIMESTAMP
|
|
====
|
|
---- QUERY
|
|
# EXECUTE ROLLBACK fails on a non-Iceberg table.
|
|
ALTER TABLE functional_parquet.alltypestiny EXECUTE ROLLBACK(1111111)
|
|
---- CATCH
|
|
ALTER TABLE EXECUTE ROLLBACK is only supported for Iceberg tables
|
|
==== |