ebyhr commented on code in PR #16074:
URL: https://github.com/apache/iceberg/pull/16074#discussion_r3120980849
##########
api/src/test/java/org/apache/iceberg/transforms/TestProjection.java:
##########
@@ -394,4 +394,27 @@ public void testProjectionNames() {
Projections.inclusive(partitionSpec).project(equal(truncate("string", 10),
"abc"));
assertThat(predicate.ref().name()).isEqualTo("string_trunc");
}
+
+ @Test
+ public void testIdentityProjectionWithTransformPredicate() {
+ // Regression test for https://github.com/apache/iceberg/issues/15502
+ // Identity-partitioned timestamptz field filtered with hours() should not
throw
Review Comment:
This sentence looks incomplete. "... should not throw ValidationException"?
##########
api/src/test/java/org/apache/iceberg/transforms/TestProjection.java:
##########
@@ -394,4 +394,27 @@ public void testProjectionNames() {
Projections.inclusive(partitionSpec).project(equal(truncate("string", 10),
"abc"));
assertThat(predicate.ref().name()).isEqualTo("string_trunc");
}
+
+ @Test
+ public void testIdentityProjectionWithTransformPredicate() {
+ // Regression test for https://github.com/apache/iceberg/issues/15502
+ // Identity-partitioned timestamptz field filtered with hours() should not
throw
+ Schema schema =
+ new Schema(
+ required(1, "id", Types.LongType.get()),
+ required(2, "ts", Types.TimestampType.withZone()));
+
+ PartitionSpec spec =
PartitionSpec.builderFor(schema).identity("ts").build();
+
+ Expression hourFilter = equal(hour("ts"), 490674);
+ Expression projected = Projections.inclusive(spec).project(hourFilter);
+
+ // The identity transform cannot project a hours-transform predicate, so
it should
+ // be replaced with alwaysTrue (inclusive) rather than throwing
ValidationException
+ assertThat(projected).isEqualTo(Expressions.alwaysTrue());
Review Comment:
ValidationException isn't thrown in this test even if I revert a change of
Identity.java.
--
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]