Apache Iceberg version
1.5.2
Query engine
Spark
Please describe the bug 🐞
CatalogHandlers (used by Rest Catalog) when executing updateTable with transaction code will always create an empty builder of default table version 2 (in Iceberg 1.5.2). This does not work if user intentionally want to create v1 table, as a result, query like
CALL spark_catalog.system.snapshot(..., map('format-version', '1');
will fail with Cannot downgrade v2 table to v1 error.
A propose fix is when calling TableMetadata.buildFromEmpty() we honor the format version if the request already set it.
Willingness to contribute