ibis-project / ibis

the portable Python dataframe library
https://ibis-project.org
Apache License 2.0
4.3k stars 537 forks source link

fix(api): treat `col == None` or `col == ibis.NA` as `col.isnull()` #9114

Closed jcrist closed 1 week ago

jcrist commented 2 weeks ago

Previously we coerced co == None to IdenticalTo(col, None), but wouldn't do so for ibis.NA (resulting in that compiling as Equals(col, None) (which would result in incorrect SQL). This PR fixes this eager branch to handle any null literal, and compiles it the same as isnull/notnull (usually col IS NULL) rather than the more verbose col IS NOT DISTINCT FROM NULL that using IdenticalTo would result in.

Other options for this fix would be to:

cpcloud commented 2 weeks ago

How would someone compute a NULL-preserving equality with this change? It seems like it would no longer be possible to do that.

For the semantics you've defined here, you can already do this with a.identical_to(NA).

cpcloud commented 2 weeks ago

Oh, it looks like we're doing that already (as you note in the description), nevermind!