CREATE OR REPLACE in Iceberg Rest Catalog Doesn't Preserve Snapshot History #24056
Unanswered
ofirNakdai
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I was also able to reproduce issue with CREATE OR REPLACE TABLE test1 AS SELECT 'value' col;
UPDATE test1 SET col = 'new value';
SELECT * FROM "test1$snapshots";
CREATE OR REPLACE TABLE test1 AS SELECT 'value' col;
SELECT * FROM test1 FOR TIMESTAMP AS OF TIMESTAMP '...'; -- fails as stated above
SELECT * FROM test1 FOR VERSION AS OF 2786598815656921987; -- works I believe it has to do with how table is loaded( Table table = catalog.loadTable(...);
List<HistoryEntry> history = table.history(); // list has only one entry of latest snapshot for time travel with timestamp query in Rest vs HMS has three entries.
Time travel with snapshot id works as it doesn't use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Trino team,
We're experiencing an issue with the Iceberg Rest Catalog where using the
CREATE OR REPLACE TABLE
statement seems to replace the entire snapshot history instead of preserving it. Here's a detailed summary of our setup and issue:Setup:
iceberg.catalog.type=rest
and pointing to the Iceberg Rest Catalog viahttp://rest:8183
Steps to Reproduce:
CREATE OR REPLACE TABLE rest_catalog.test_schema.test1 AS (SELECT * FROM tpch.tiny.orders)
.totalprice
column), creating a new snapshot in the history.CREATE OR REPLACE TABLE
statement with updated data, expecting this to keep the history intact.SELECT * FROM rest_catalog.test_schema.test1 FOR TIMESTAMP AS OF
returns an error:SQL Error [76]: No version history table "test_schema".test1 at or before
Looking at the metadata table, it appears the previous snapshots are not linked to the new snapshot, suggesting CREATE OR REPLACE might be invalidating the history. However, according to the Iceberg documentation, CREATE OR REPLACE should create a new snapshot while retaining the old ones.
Any insights or suggestions on why this might be occurring would be greatly appreciated.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions