@@ -1682,6 +1682,39 @@ def test_bucket_pyarrow_void_transform() -> None:
16821682 assert output_arr == VoidTransform ().pyarrow_transform (IntegerType ())(input_arr )
16831683
16841684
1685+ # Regression test for https://github.com/apache/iceberg-python/issues/3633
1686+ @pytest .mark .parametrize (
1687+ "source_type, input_arr, expected, num_buckets" ,
1688+ [
1689+ (
1690+ StringType (),
1691+ pa .array (["foo" , "bar" , "foo" ], type = pa .dictionary (pa .int32 (), pa .utf8 ())),
1692+ pa .array ([6 , 7 , 6 ], type = pa .int32 ()),
1693+ 10 ,
1694+ ),
1695+ (
1696+ StringType (),
1697+ pa .chunked_array (
1698+ [
1699+ pa .array (["foo" , "bar" ], type = pa .dictionary (pa .int32 (), pa .utf8 ())),
1700+ pa .array (["baz" ], type = pa .dictionary (pa .int32 (), pa .utf8 ())),
1701+ ]
1702+ ),
1703+ pa .chunked_array ([pa .array ([6 , 7 ], type = pa .int32 ()), pa .array ([4 ], type = pa .int32 ())]),
1704+ 10 ,
1705+ ),
1706+ ],
1707+ )
1708+ def test_bucket_pyarrow_transform_dictionary_encoded (
1709+ source_type : PrimitiveType ,
1710+ input_arr : pa .Array | pa .ChunkedArray ,
1711+ expected : pa .Array | pa .ChunkedArray ,
1712+ num_buckets : int ,
1713+ ) -> None :
1714+ transform : Transform [Any , Any ] = BucketTransform (num_buckets = num_buckets )
1715+ assert expected == transform .pyarrow_transform (source_type )(input_arr )
1716+
1717+
16851718@pytest .mark .parametrize (
16861719 "source_type, input_arr, expected, width" ,
16871720 [
0 commit comments