edwinchoi commented on pull request #1508:
URL: https://github.com/apache/iceberg/pull/1508#issuecomment-701601287


   @rdblue, how would a snapshot be recorded in the metadata if it weren't at 
some point current? Intermediate snapshots are removed on commit, so I would 
imagine the only case where the metadata could refer to snapshots that were 
never current is if the commit were rejected. In that case, the snapshots 
wouldn't be reachable from the current commit. What am I missing?
   
   Example:
   ```sql
   -- S1
   CREATE TABLE test.ns.tbl USING iceberg AS
   SELECT * FROM VALUES (1, "Alice"), (2, "Bob") AS (id, fname);
   
   -- S2
   CREATE OR REPLACE TABLE test.ns.tbl USING iceberg AS
   SELECT * FROM VALUES (1, 5, "alice"), (2, 3, "bob") AS (id, name_len, name) ;
   
   -- S3
   INSERT INTO test.ns.tbl VALUES (3, 5, "carol")
   ```
   
   The table `test.ns.tbl` has 3 valid states. So we should be able to read 
each one individually. `Table.history()`, after all 3 statements have executed, 
only returns entries for `S2` and `S3`; while `Table.snapshots()` returns all 3.
   
   You can rewind to `S1`, so it seems time-travel is using snapshots not the 
log. Trying to read the data will fail since it tries to cast the 2nd field to 
an integer, but it will succeed if you rewrite the snippet to use `(id, name, 
name_len)`.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to