geruh commented on code in PR #14280:
URL: https://github.com/apache/iceberg/pull/14280#discussion_r2418006980


##########
core/src/test/java/org/apache/iceberg/hadoop/TestTableSerialization.java:
##########
@@ -199,6 +203,23 @@ private static Table getMetaDataTable(Table table, 
MetadataTableType type) {
         ((HasTableOperations) 
table).operations().current().metadataFileLocation() + "#" + type);
   }
 
+  @Test
+  public void testLocationProviderExceptionIsDeferred() {
+    Table spyTable = spy(table);
+    RuntimeException failure = new RuntimeException("location provider 
failure");
+    when(spyTable.locationProvider()).thenThrow(failure);
+
+    // SerializableTable.copyOf should not throw an exception even if 
locationProvider fails
+    Table serializableTable = SerializableTable.copyOf(spyTable);
+    assertThat(serializableTable).isNotNull();
+
+    // The exception should be thrown when locationProvider() is actually 
called
+    assertThatThrownBy(serializableTable::locationProvider).isSameAs(failure);
+

Review Comment:
   Should we add a test for round trip serialization to ensure the behavior is 
the same?
   
   TestHelpers.KryoHelpers.roundTripSerialize(serializableTable)



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