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


##########
core/src/main/java/org/apache/iceberg/SortOrderParser.java:
##########
@@ -112,6 +112,10 @@ public static SortOrder fromJson(Schema schema, String 
json) {
     return fromJson(json).bind(schema);
   }
 
+  public static SortOrder fromJson(Schema schema, String json, int 
defaultSortOderId) {

Review Comment:
   Nit: typo in `defaultSortOrderId`



##########
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:
   The test needs to verify round trip serialization using 
`TestHelpers.roundTripSerialize()` and 
`TestHelpers.KryoHelpers.roundTripSerialize()`. You can look at other tests in 
this class to see how. 



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