@@ -236,18 +236,19 @@ def test_is_not_nan() -> None:
236236 assert residual == AlwaysTrue ()
237237
238238
239- def test_comparison_residual_with_null_partition_value () -> None :
240- # Regression test for https://github.com/apache/iceberg-python/issues/3498
241- # A nullable identity-partitioned column whose partition value is None must not raise a
242- # TypeError when compared against a literal; it should behave like row evaluation, where a
243- # null value never satisfies an ordering predicate.
244- schema = Schema (NestedField (50 , "x" , IntegerType (), required = False ), NestedField (51 , "hour" , IntegerType ()))
239+ def test_comparison_residuals_for_null_identity_partition () -> None :
240+ schema = Schema (NestedField (50 , "x" , IntegerType (), required = False ))
245241 spec = PartitionSpec (PartitionField (50 , 1050 , IdentityTransform (), "x_part" ))
246242
247- for predicate in (LessThan ("x" , 1 ), LessThanOrEqual ("x" , 1 ), GreaterThan ("x" , 1 ), GreaterThanOrEqual ("x" , 1 )):
243+ for predicate , expected in (
244+ (LessThan ("x" , 1 ), AlwaysTrue ()),
245+ (LessThanOrEqual ("x" , 1 ), AlwaysTrue ()),
246+ (GreaterThan ("x" , 1 ), AlwaysFalse ()),
247+ (GreaterThanOrEqual ("x" , 1 ), AlwaysFalse ()),
248+ ):
248249 res_eval = residual_evaluator_of (spec = spec , expr = predicate , case_sensitive = True , schema = schema )
249250 residual = res_eval .residual_for (Record (None ))
250- assert residual == AlwaysFalse (), f"null partition value should not match { predicate } "
251+ assert residual == expected
251252
252253
253254def test_not_in_timestamp () -> None :
0 commit comments