Baunsgaard commented on code in PR #16208:
URL: https://github.com/apache/iceberg/pull/16208#discussion_r3304049038
##########
core/src/test/java/org/apache/iceberg/TestMetadataTableScans.java:
##########
@@ -521,6 +523,33 @@ public void testPartitionsTableScanWithProjection() {
validateSingleFieldPartition(entries, 3);
}
+ @TestTemplate
+ public void testPartitionsTableReusesPartitionDataSchema() throws Exception {
+ preparePartitionedTable();
+
+ Table partitionsTable = new PartitionsTable(table);
+ StaticTableScan scan = (StaticTableScan) partitionsTable.newScan();
+ List<org.apache.avro.Schema> partitionSchemas = Lists.newArrayList();
+
+ Method partitionsMethod =
+ PartitionsTable.class.getDeclaredMethod("partitions", Table.class,
StaticTableScan.class);
+ partitionsMethod.setAccessible(true);
Review Comment:
The test access the private internals via reflection.
While it works, it is brittle. A rename of the private method or fields
silently breaks the test at runtime instead of compile time.
An alternative is to add the `@VisibleForTesting` flag. Since `Partition`
is already package-private, it should be okay to just extend it for testing.
--
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]