rdblue commented on code in PR #8032:
URL: https://github.com/apache/iceberg/pull/8032#discussion_r1277819298
##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -2003,4 +2008,48 @@ public void
multipleDiffsAgainstMultipleTablesLastFails() {
assertThat(schema2.findField("new-column")).isNull();
assertThat(schema2.columns()).hasSize(1);
}
+
+ @Test
+ public void testScanReportingOnSerializableTable() throws IOException,
ClassNotFoundException {
+ Table table = catalog().buildTable(TABLE, SCHEMA).create();
+ table
+ .newFastAppend()
+ .appendFile(
+ DataFiles.builder(PartitionSpec.unpartitioned())
+ .withPath("/path/to/data-a.parquet")
+ .withFileSizeInBytes(10)
+ .withRecordCount(2)
+ .build())
+ .commit();
+
+ table = catalog().loadTable(TABLE);
+ Mockito.reset(adaptor);
+
+ try (CloseableIterable<FileScanTask> tasks = table.newScan().planFiles()) {
+ assertThat(tasks.iterator()).hasNext();
+ }
+
+ Table serializableTable =
+
TestHelpers.KryoHelpers.roundTripSerialize(SerializableTable.copyOf(table));
+ try (CloseableIterable<FileScanTask> tasks =
serializableTable.newScan().planFiles()) {
+ assertThat(tasks.iterator()).hasNext();
+ }
+
+ serializableTable =
TestHelpers.roundTripSerialize(SerializableTable.copyOf(table));
+ try (CloseableIterable<FileScanTask> tasks =
serializableTable.newScan().planFiles()) {
+ assertThat(tasks.iterator()).hasNext();
+ }
+
+ // once the table is serialized, it should still be able to send metrics
reports via REST
+ ResourcePaths paths =
ResourcePaths.forCatalogProperties(Maps.newHashMap());
+ verify(adaptor, times(3))
Review Comment:
Why do you need to keep the adapter around? Other tests create their own
adapter for assertions like this. For example, `testCatalogBasicBearerToken`. I
think you could just create a new one like that.
--
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]