zeel2104 opened a new pull request, #1489:
URL: https://github.com/apache/datafusion-python/pull/1489
# Which issue does this PR close?
Closes #1483.
# Rationale for this change
Comparing expressions to `None` with `==` currently builds a regular
equality comparison against a null literal, which follows SQL null semantics
and does not match null values in filters. This is surprising for Python users,
especially since comparing against other scalar values works as expected and
the equivalent `.is_null()` expression does return the expected rows.
# What changes are included in this PR?
- Special-case `Expr.__eq__` so `expr == None` maps to `expr.is_null()`
- Special-case `Expr.__ne__` so `expr != None` maps to `expr.is_not_null()`
- Add regression tests covering `== None` and `!= None` on nullable integer
and string columns
# Are there any user-facing changes?
Yes. Python users can now write `col("a") == None` and `col("a") != None` as
shorthand for `is_null()` and `is_not_null()`.
`is None` is not supported because Python identity checks cannot be
overloaded.
--
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]