nastra commented on code in PR #8032:
URL: https://github.com/apache/iceberg/pull/8032#discussion_r1287229149
##########
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:
we need to have a non-empty table for the scans to send a report, thus we
want to hit the actual servlet when doing the scans and it seemed easier to
just spy on the original `adapter` than re-configuring everything here
--
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]