MonkeyCanCode commented on code in PR #16521:
URL: https://github.com/apache/iceberg/pull/16521#discussion_r3285317440


##########
core/src/test/java/org/apache/iceberg/hadoop/TestTableSerialization.java:
##########
@@ -79,6 +79,27 @@ public void testSerializableTable() throws IOException, 
ClassNotFoundException {
         .isEqualTo(TableUtil.metadataFileLocation(table));
   }
 
+  @Test
+  public void testSerializableTableSortOrdersWithDroppedColumn() {
+    // add an extra column and establish sort order 1 on id + ts
+    table.updateSchema().addColumn("ts", Types.LongType.get()).commit();
+    table.replaceSortOrder().asc("id").asc("ts").commit();
+    table.newAppend().appendFile(FILE_A).commit();
+
+    // switch to sort order 2 using only "id", then drop "ts"
+    // historical sort order 1 still references the dropped "ts" field
+    table.replaceSortOrder().asc("id").commit();
+    table.updateSchema().deleteColumn("ts").commit();
+
+    // SerializableTable.copyOf captures all sort orders at construction time
+    Table serialized = SerializableTable.copyOf(table);

Review Comment:
   Oh yeah, I was copied the test provided in the reported issue. Updated now.



-- 
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: [email protected]

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