You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
A similar issue regarding "IS NOT TRUE/FALSE" syntax has already been opened (#2265), but it doesn't look like there is support for the "IS TRUE/FALSE" syntax either.
Describe the solution you'd like
Enum datafusion::logical_plan::Expr should include functionality for IsTrue and IsFalse.
So this should be a fairly straightforward exercise -- note that IS and = are very subtlety differnt
Since we already have similar semantics for IS with the IS NOT DISTINCT FROM longer form syntax, I think this could potentially simply have the the SQL planner plan
IS <expr>
as
is not distinct from<expr>as'IS <expr.
Here is what postgres does
psql (14.4)
Type "help" for help.
alamb=# select null = null;
?column?
----------
(1 row)
alamb=# select null IS null;
?column?
----------
t
(1 row)
alamb=# select null IS DISTINCT FROM null;
?column?
----------
f
(1 row)
alamb=# select null IS NOT DISTINCT FROM null;
?column?
----------
t
(1 row)
Activity
alamb commentedon Aug 15, 2022
Looks like there is sqlparser support: https://docs.rs/sqlparser/latest/sqlparser/ast/enum.Expr.html#variant.IsTrue
Added in
0.18.0: https://github.com/sqlparser-rs/sqlparser-rs/blob/main/CHANGELOG.md#0180-2022-06-06So this should be a fairly straightforward exercise -- note that
ISand=are very subtlety differntSince we already have similar semantics for
ISwith theIS NOT DISTINCT FROMlonger form syntax, I think this could potentially simply have the the SQL planner planas
Here is what postgres does
sarahyurick commentedon Aug 15, 2022
Thanks for the response! I'll start working on this.
alamb commentedon Aug 15, 2022
@sarahyurick here is an example of doing something similar for
array:https://github.com/apache/arrow-datafusion/pull/3122/files#diff-c01a34949db6258aa1593f011ecf90f62cbde406acd5cdbf8b9b60b970ace1cfR2372-R2374
So in other words you can probably do something like (untested):
https://github.com/apache/arrow-datafusion/blob/ee55d89cbf20f4a6d17fe399c72d60dca6d67912/datafusion/expr/src/operator.rs#L59