rdblue commented on code in PR #6247:
URL: https://github.com/apache/iceberg/pull/6247#discussion_r1032981587


##########
python/tests/expressions/test_visitors.py:
##########
@@ -1429,3 +1432,162 @@ def test_rewrite_bound():
             accessor=Accessor(position=0, inner=None),
         )
     )
+
+
[email protected]
+def spec() -> PartitionSpec:
+    return PartitionSpec(PartitionField(1, 1000, IdentityTransform(), "id"))
+
+
+def test_identity_projection(schema: Schema, spec: PartitionSpec):
+    predicates = [
+        NotNull("id"),
+        IsNull("id"),
+        LessThan("id", 100),
+        LessThanOrEqual("id", 101),
+        GreaterThan("id", 102),
+        GreaterThanOrEqual("id", 103),
+        EqualTo("id", 104),
+        NotEqualTo("id", 105),
+    ]
+
+    expected = [
+        BoundNotNull(
+            term=BoundReference[int](
+                field=NestedField(field_id=1000, name="id", 
field_type=IntegerType(), required=False),

Review Comment:
   So the problem here is that these tests aren't actually projecting the 
predicates. These are just binding the unbound predicates to the partition type 
in `visit_unbound_predicate`. Although these bound expressions look correct, 
they are only correct because the underlying spec uses an identity transform 
with the same name for the partition field.
   
   I think if you were to rename the partition field, these tests would fail 
because the field name ("id") is not found in the partition schema.



-- 
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]

Reply via email to