rdblue commented on code in PR #6128:
URL: https://github.com/apache/iceberg/pull/6128#discussion_r1022122972
##########
python/tests/test_transforms.py:
##########
@@ -506,3 +532,345 @@ def test_datetime_transform_str(transform, transform_str):
)
def test_datetime_transform_repr(transform, transform_repr):
assert repr(transform) == transform_repr
+
+
[email protected]
+def bound_reference_str() -> BoundReference:
+ return BoundReference(field=NestedField(1, "field", StringType(),
required=False), accessor=Accessor(position=0, inner=None))
+
+
[email protected]
+def bound_reference_date() -> BoundReference:
+ return BoundReference(field=NestedField(1, "field", DateType(),
required=False), accessor=Accessor(position=0, inner=None))
+
+
[email protected]
+def bound_reference_timestamp() -> BoundReference:
+ return BoundReference(
+ field=NestedField(1, "field", TimestampType(), required=False),
accessor=Accessor(position=0, inner=None)
+ )
+
+
[email protected]
+def bound_reference_decimal() -> BoundReference:
+ return BoundReference(
+ field=NestedField(1, "field", DecimalType(8, 2), required=False),
accessor=Accessor(position=0, inner=None)
+ )
+
+
[email protected]
+def bound_reference_long() -> BoundReference:
+ return BoundReference(
+ field=NestedField(1, "field", DecimalType(8, 2), required=False),
accessor=Accessor(position=0, inner=None)
+ )
+
+
+def test_projection_bucket_unary(bound_reference_str: BoundReference) -> None:
+ assert BucketTransform(2).project("name",
BoundNotNull(term=bound_reference_str)) == NotNull(term=Reference(name="name"))
+
+
+def test_projection_bucket_literal(bound_reference_str: BoundReference) ->
None:
Review Comment:
I think we need tests for every combination of Transform and Predicate. For
example, I'd like to see a parameterized test for all of the inequalities that
return `None`, to make sure that if the implementation changes, tests are still
there to validate it. An important one that is missing is also `NotEqualTo`,
which can't be projected through Bucket.
--
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]