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


##########
python/tests/expressions/test_visitors.py:
##########
@@ -1429,3 +1432,162 @@ def test_rewrite_bound():
             accessor=Accessor(position=0, inner=None),
         )
     )
+
+
+@pytest.fixture
+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),
+                accessor=Accessor(position=0, inner=None),
+            )
+        ),
+        BoundIsNull(
+            term=BoundReference[int](
+                field=NestedField(field_id=1000, name="id", 
field_type=IntegerType(), required=False),
+                accessor=Accessor(position=0, inner=None),
+            )
+        ),
+        BoundLessThan(
+            term=BoundReference[int](
+                field=NestedField(field_id=1000, name="id", 
field_type=IntegerType(), required=False),
+                accessor=Accessor(position=0, inner=None),
+            ),
+            literal=literal(100),
+        ),
+        BoundLessThanOrEqual(
+            term=BoundReference[int](
+                field=NestedField(field_id=1000, name="id", 
field_type=IntegerType(), required=False),
+                accessor=Accessor(position=0, inner=None),
+            ),
+            literal=literal(101),
+        ),
+        BoundGreaterThan(
+            term=BoundReference[int](
+                field=NestedField(field_id=1000, name="id", 
field_type=IntegerType(), required=False),
+                accessor=Accessor(position=0, inner=None),
+            ),
+            literal=literal(102),
+        ),
+        BoundGreaterThanOrEqual(
+            term=BoundReference[int](
+                field=NestedField(field_id=1000, name="id", 
field_type=IntegerType(), required=False),
+                accessor=Accessor(position=0, inner=None),
+            ),
+            literal=literal(103),
+        ),
+        BoundEqualTo(
+            term=BoundReference[int](
+                field=NestedField(field_id=1000, name="id", 
field_type=IntegerType(), required=False),
+                accessor=Accessor(position=0, inner=None),
+            ),
+            literal=literal(104),
+        ),
+        BoundNotEqualTo(
+            term=BoundReference[int](
+                field=NestedField(field_id=1000, name="id", 
field_type=IntegerType(), required=False),
+                accessor=Accessor(position=0, inner=None),
+            ),
+            literal=literal(105),
+        ),
+    ]
+
+    for idx in range(len(predicates)):

Review Comment:
   I didn't spend many cycles on this. I changed it into:
   ```
   for predicate, expected in zip(predicates, expected_bound):
       expr = inclusive_projection(predicate, schema, spec)
       assert expr == expected
   ```
   I think the `zip` is nicer than the `enumerate`



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to