przemekd commented on code in PR #14280:
URL: https://github.com/apache/iceberg/pull/14280#discussion_r2433965072
##########
spark/v4.0/spark/src/test/java/org/apache/iceberg/TestTableSerialization.java:
##########
@@ -158,6 +159,39 @@ public void
testSerializableTransactionTableKryoSerialization() throws IOExcepti
txnTable, KryoHelpers.roundTripSerialize(serializableTxnTable));
}
+ @TestTemplate
+ public void testLocationProviderExceptionIsDeferred() {
+ Table spyTable = spy(table);
+ RuntimeException failure = new RuntimeException("location provider
failure");
+ when(spyTable.locationProvider()).thenThrow(failure);
+
+ Table serializableTable = SerializableTableWithSize.copyOf(spyTable);
+ assertThat(serializableTable).isNotNull();
+
+ assertThatThrownBy(serializableTable::locationProvider).isSameAs(failure);
+ verify(spyTable, times(1)).locationProvider();
+ }
+
+ @TestTemplate
+ public void testLocationProviderExceptionSerializationRoundTrip()
+ throws IOException, ClassNotFoundException {
+ Table spyTable = spy(table);
+ RuntimeException failure = new RuntimeException("location provider
failure");
+ when(spyTable.locationProvider()).thenThrow(failure);
+
+ Table serializableTable = SerializableTableWithSize.copyOf(spyTable);
+
+ Table javaDeserialized = TestHelpers.roundTripSerialize(serializableTable);
+ assertThatThrownBy(javaDeserialized::locationProvider)
+ .isInstanceOf(RuntimeException.class)
+ .hasMessage("location provider failure");
+
+ Table kryoDeserialized = KryoHelpers.roundTripSerialize(serializableTable);
+ assertThatThrownBy(kryoDeserialized::locationProvider)
+ .isInstanceOf(RuntimeException.class)
+ .hasMessage("location provider failure");
Review Comment:
Sure thing, it makes total sense 👍🏻
--
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]