Baunsgaard commented on code in PR #16208:
URL: https://github.com/apache/iceberg/pull/16208#discussion_r3304084323
##########
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);
+ @SuppressWarnings("unchecked")
+ Iterable<PartitionsTable.Partition> partitions =
+ (Iterable<PartitionsTable.Partition>) partitionsMethod.invoke(null,
table, scan);
+ Field partitionDataField =
PartitionsTable.Partition.class.getDeclaredField("partitionData");
+ partitionDataField.setAccessible(true);
+
+ for (PartitionsTable.Partition partition : partitions) {
+ PartitionData partitionData = (PartitionData)
partitionDataField.get(partition);
+ partitionSchemas.add(partitionData.getSchema());
+ }
+
+ assertThat(partitionSchemas).hasSize(4);
Review Comment:
While the `preparePartitionedTable()` today has a schema with size 4, a
future edit to that helper would make this test fail for unrelated reasons.
Since the actual claim is "all partition rows share one Schema instance,"
`hasSizeGreaterThanOrEqualTo(2)` is enough and stays robust. SInce we only need
to verify that the test ran with an input of more than one Schema file.
--
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]