ebyhr commented on code in PR #17261:
URL: https://github.com/apache/iceberg/pull/17261#discussion_r3642862365
##########
api/src/test/java/org/apache/iceberg/transforms/TestProjection.java:
##########
@@ -394,4 +394,34 @@ 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
+ // When an identity-partitioned timestamptz field is filtered with
hours(), the
+ // projection must return alwaysTrue (inclusive) or alwaysFalse (strict)
because
+ // the identity transform cannot project a transform-based predicate.
+ //
+ // Without the fix, projectStrict() returns an invalid UnboundPredicate
with an
+ // integer literal (490674) for a timestamptz field. This test fails
because the
+ // result is neither alwaysTrue nor alwaysFalse -- it is the invalid
predicate
+ // "ts == 490674" which causes a downstream ValidationException when
evaluated.
Review Comment:
I think the current comment is too verbose. Suggested replacement:
```
// Regression test for https://github.com/apache/iceberg/issues/15502.
// Identity transform cannot project a transform-based predicate (e.g.,
hours(ts)),
// so projection must fall back to alwaysTrue (inclusive) or alwaysFalse
(strict).
```
--
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]