Fokko commented on code in PR #1573: URL: https://github.com/apache/iceberg-python/pull/1573#discussion_r1932470016
########## tests/table/test_partitioning.py: ########## @@ -186,11 +194,27 @@ def test_partition_type(table_schema_simple: Schema) -> None: (BinaryType(), b"\x8e\xd1\x87\x01"), ], ) -def test_bucketing_function(source_type: PrimitiveType, value: Any) -> None: - bucket = BucketTransform(2) # type: ignore +def test_transform_consistency_with_pyarrow_transform(source_type: PrimitiveType, value: Any) -> None: import pyarrow as pa - assert bucket.transform(source_type)(value) == bucket.pyarrow_transform(source_type)(pa.array([value])).to_pylist()[0] + all_transforms = [ # type: ignore + IdentityTransform(), + BucketTransform(10), + TruncateTransform(10), + YearTransform(), + MonthTransform(), + DayTransform(), + HourTransform(), + ] + for t in all_transforms: + if t.can_transform(source_type): + try: + assert t.transform(source_type)(value) == t.pyarrow_transform(source_type)(pa.array([value])).to_pylist()[0] + except ValueError as e: + # Skipping unsupported feature + if "FeatureUnsupported => Unsupported data type for truncate transform" in str(e): Review Comment: Looks like `binary` is not supported: https://github.com/apache/iceberg-rust/pull/920 -- 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