szehon-ho commented on code in PR #5443:
URL: https://github.com/apache/iceberg/pull/5443#discussion_r940665416
##########
core/src/test/java/org/apache/iceberg/TestMetadataTableFilters.java:
##########
@@ -153,20 +160,46 @@ private boolean isAggFileTable(MetadataTableType
tableType) {
return aggFileTables.contains(tableType);
}
+ private String partitionColumn(String colName) {
+ switch (type) {
+ case FILES:
+ case DATA_FILES:
+ case DELETE_FILES:
+ case ALL_DATA_FILES:
+ case ALL_DELETE_FILES:
+ case ALL_FILES:
+ return String.format("partition.%s", colName);
+ case ENTRIES:
+ case ALL_ENTRIES:
+ return String.format("data_file.partition.%s", colName);
+ default:
+ throw new IllegalArgumentException("Unsupported metadata table type:"
+ type);
+ }
+ }
+
+ /** @return a basic expression that always evaluates to true, to test AND
logic */
+ private Expression dummyExpression() {
+ switch (type) {
+ case FILES:
+ case DATA_FILES:
+ case DELETE_FILES:
+ case ALL_DATA_FILES:
+ case ALL_DELETE_FILES:
+ case ALL_FILES:
+ return Expressions.greaterThan("record_count", 0);
+ case ENTRIES:
+ case ALL_ENTRIES:
+ return Expressions.greaterThan("data_file.record_count", 0);
+ default:
+ throw new IllegalArgumentException("Unsupported metadata table type:"
+ type);
+ }
+ }
+
@Test
public void testNoFilter() {
Table metadataTable = createMetadataTable();
- Types.StructType expected =
- new Schema(
- required(
- 102,
- "partition",
- Types.StructType.of(optional(1000, "data_bucket",
Types.IntegerType.get())),
- "Partition data tuple, schema based on the partition
spec"))
- .asStruct();
-
- TableScan scan = metadataTable.newScan().select("partition.data_bucket");
- Assert.assertEquals(expected, scan.schema().asStruct());
+
+ TableScan scan =
metadataTable.newScan().select(partitionColumn("data_bucket"));
Review Comment:
Ah I wrote this Test class initially to have one partition-filter-pushdown
test various metadata tables (files, all_files, etc), but this assertion would
kind of not work here. There should be other tests that assert the same thing
(can add if not), and also end to end sql tests that excercise this.
--
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]