timsaucer commented on code in PR #1489:
URL:
https://github.com/apache/datafusion-python/pull/1489#discussion_r3069521847
##########
python/tests/test_expr.py:
##########
@@ -173,6 +173,24 @@ def test_relational_expr(test_ctx):
assert df.filter(col("a") == "beta").count() == 0
+def test_relational_expr_none_uses_null_predicates():
+ ctx = SessionContext()
+
+ batch = pa.RecordBatch.from_arrays(
+ [
+ pa.array([1, 2, None]),
+ pa.array(["alpha", None, "gamma"], type=pa.string_view()),
+ ],
+ names=["a", "b"],
+ )
+ df = ctx.create_dataframe([[batch]], name="batch_with_nulls")
+
+ assert df.filter(col("a") == None).count() == 1 # noqa: E711
+ assert df.filter(col("a") != None).count() == 2 # noqa: E711
+ assert df.filter(col("b") == None).count() == 1 # noqa: E711
+ assert df.filter(col("b") != None).count() == 2 # noqa: E711
Review Comment:
I think you can just update the `test_relational_expr` to have some null
values and incorporate this into the existing test.
--
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]