@@ -2189,33 +2189,40 @@ def test_stats_aggregator_update_max(vals: List[Any], primitive_type: PrimitiveT
21892189
21902190
21912191@pytest .mark .parametrize (
2192- "iceberg_type, physical_type_string, should_succeed " ,
2192+ "iceberg_type, physical_type_string" ,
21932193 [
21942194 # Exact match
2195- (IntegerType (), "INT32" , True ),
2195+ (IntegerType (), "INT32" ),
21962196 # Allowed INT32 -> INT64 promotion
2197- (LongType (), "INT32" , True ),
2197+ (LongType (), "INT32" ),
21982198 # Allowed FLOAT -> DOUBLE promotion
2199- (DoubleType (), "FLOAT" , True ),
2199+ (DoubleType (), "FLOAT" ),
22002200 # Allowed FIXED_LEN_BYTE_ARRAY -> INT32
2201- (DecimalType (precision = 2 , scale = 2 ), "FIXED_LEN_BYTE_ARRAY" , True ),
2201+ (DecimalType (precision = 2 , scale = 2 ), "FIXED_LEN_BYTE_ARRAY" ),
22022202 # Allowed FIXED_LEN_BYTE_ARRAY -> INT64
2203- (DecimalType (precision = 12 , scale = 2 ), "FIXED_LEN_BYTE_ARRAY" , True ),
2203+ (DecimalType (precision = 12 , scale = 2 ), "FIXED_LEN_BYTE_ARRAY" ),
2204+ ],
2205+ )
2206+ def test_stats_aggregator_conditionally_allowed_types_pass (iceberg_type : PrimitiveType , physical_type_string : str ) -> None :
2207+ stats = StatsAggregator (iceberg_type , physical_type_string )
2208+
2209+ assert stats .primitive_type == iceberg_type
2210+ assert stats .current_min is None
2211+ assert stats .current_max is None
2212+
2213+
2214+ @pytest .mark .parametrize (
2215+ "iceberg_type, physical_type_string" ,
2216+ [
22042217 # Fail case: INT64 cannot be cast to INT32
2205- (IntegerType (), "INT64" , False ),
2218+ (IntegerType (), "INT64" ),
22062219 ],
22072220)
2208- def test_stats_aggregator_conditionally_allowed_types (
2209- iceberg_type : PrimitiveType , physical_type_string : str , should_succeed : bool
2221+ def test_stats_aggregator_physical_type_does_not_match_expected_raise_error (
2222+ iceberg_type : PrimitiveType , physical_type_string : str
22102223) -> None :
2211- if should_succeed :
2212- stats = StatsAggregator (iceberg_type , physical_type_string )
2213- assert stats .primitive_type == iceberg_type
2214- assert stats .current_min is None
2215- assert stats .current_max is None
2216- else :
2217- with pytest .raises (ValueError , match = "Unexpected physical type" ):
2218- StatsAggregator (iceberg_type , physical_type_string )
2224+ with pytest .raises (ValueError , match = "Unexpected physical type" ):
2225+ StatsAggregator (iceberg_type , physical_type_string )
22192226
22202227
22212228def test_bin_pack_arrow_table (arrow_table_with_null : pa .Table ) -> None :
0 commit comments