oneonestar opened a new issue, #9758:
URL: https://github.com/apache/iceberg/issues/9758

   ### Apache Iceberg version
   
   main (development)
   
   ### Query engine
   
   None
   
   ### Please describe the bug 🐞
   
   `latest_schema_id` in metadata_log_entries behaves strangely for ALTER TABLE.
   ALTER TABLE updates the metadata file and its `current-schema-id`, but it 
will not update the snapshot.
   If `latest_schema_id` is associated with the metadata file, the value should 
be 1. 
   Now the `latest_schema_id` is associated with the snapshot in the metadata 
file, so the value is 0.
   
   Isn't this confusing consider that this table is `metadata_log_entries` and 
metadata file should be the main entity to be associated with? A user won't be 
able to know without documentation or a better name for the column.
   
   IMO,
   * `schema_id` in the metadata table should be associated with the metadata 
file.
   * `schema_id` associated with the snapshot should be added to the snapshot 
table.
   
   Consider the following example. If `latest_schema_id` in second row is 1, it 
will clearly show that the schema has been updated in that commit.
   ```
   > create table iceberg.default.t1 (c1 integer);
   > alter table iceberg.default.t1 add column c2 varchar;
   timestamp               |         file         | latest_snapshot_id  | 
latest_schema_id | latest_sequence_number
   
------------------------+----------------------+---------------------+------------------+------------------------
   2024-01-22 08:11:35.128  | 00000.metadata.json | 3603548602758670925 |       
         0 |                      1
   2024-01-22 08:11:49.279  | 00001.metadata.json | 3603548602758670925 |       
         0 |                      1
   (2 rows)
   ```


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to