rambleraptor commented on code in PR #3547:
URL: https://github.com/apache/iceberg-python/pull/3547#discussion_r3449778491
##########
tests/expressions/test_evaluator.py:
##########
@@ -1152,6 +1152,48 @@ def test_strict_some_nulls(strict_data_file_schema:
Schema, strict_data_file_2:
assert not should_read, "Should not match: equal on some nulls column"
+def test_strict_not_equal_and_not_in_with_mixed_nulls_and_matching_bounds() ->
None:
+ schema = Schema(NestedField(1, "x", IntegerType(), required=False))
+ data_file = DataFile.from_args(
+ file_path="file.parquet",
+ file_format=FileFormat.PARQUET,
+ partition={},
+ record_count=2,
+ file_size_in_bytes=1,
+ value_counts={1: 2},
+ null_value_counts={1: 1},
+ nan_value_counts=None,
+ lower_bounds={1: to_bytes(IntegerType(), 5)},
+ upper_bounds={1: to_bytes(IntegerType(), 5)},
+ )
+
+ should_read = _StrictMetricsEvaluator(schema, NotEqualTo("x",
5)).eval(data_file)
+ assert should_read == ROWS_MIGHT_NOT_MATCH, "Should not match: bounds
prove the non-null value is 5"
Review Comment:
This feels like something that would be great as a code comment :)
##########
tests/expressions/test_evaluator.py:
##########
@@ -1152,6 +1152,48 @@ def test_strict_some_nulls(strict_data_file_schema:
Schema, strict_data_file_2:
assert not should_read, "Should not match: equal on some nulls column"
+def test_strict_not_equal_and_not_in_with_mixed_nulls_and_matching_bounds() ->
None:
+ schema = Schema(NestedField(1, "x", IntegerType(), required=False))
+ data_file = DataFile.from_args(
+ file_path="file.parquet",
+ file_format=FileFormat.PARQUET,
+ partition={},
+ record_count=2,
+ file_size_in_bytes=1,
+ value_counts={1: 2},
+ null_value_counts={1: 1},
+ nan_value_counts=None,
+ lower_bounds={1: to_bytes(IntegerType(), 5)},
+ upper_bounds={1: to_bytes(IntegerType(), 5)},
+ )
+
+ should_read = _StrictMetricsEvaluator(schema, NotEqualTo("x",
5)).eval(data_file)
+ assert should_read == ROWS_MIGHT_NOT_MATCH, "Should not match: bounds
prove the non-null value is 5"
+
+ should_read = _StrictMetricsEvaluator(schema, NotIn("x", {5,
6})).eval(data_file)
+ assert should_read == ROWS_MIGHT_NOT_MATCH, "Should not match: bounds
prove the non-null value is 5"
+
+
+def test_strict_not_equal_and_not_in_with_all_nulls() -> None:
+ schema = Schema(NestedField(1, "x", IntegerType(), required=False))
+ data_file = DataFile.from_args(
+ file_path="file.parquet",
+ file_format=FileFormat.PARQUET,
+ partition={},
+ record_count=2,
+ file_size_in_bytes=1,
+ value_counts={1: 2},
+ null_value_counts={1: 2},
+ nan_value_counts=None,
+ )
+
+ should_read = _StrictMetricsEvaluator(schema, NotEqualTo("x",
5)).eval(data_file)
Review Comment:
Code comment :)
--
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]