You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/15 19:46:13 UTC
[GitHub] [arrow-datafusion] sarahyurick opened a new issue, #3159: Support "IS TRUE/FALSE" syntax
sarahyurick opened a new issue, #3159:
URL: https://github.com/apache/arrow-datafusion/issues/3159
**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](https://docs.rs/datafusion/2.0.0/datafusion/index.html)::[logical_plan](https://docs.rs/datafusion/2.0.0/datafusion/logical_plan/index.html)::[Expr](https://docs.rs/datafusion/2.0.0/datafusion/logical_plan/enum.Expr.html) should include functionality for IsTrue and IsFalse.
**Describe alternatives you've considered**
None.
**Additional context**
None.
--
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: github-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on issue #3159: Support "IS TRUE/FALSE" syntax
Posted by GitBox <gi...@apache.org>.
alamb commented on issue #3159:
URL: https://github.com/apache/arrow-datafusion/issues/3159#issuecomment-1215753304
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-06
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
```sql
IS <expr>
```
as
```sql
is not distinct from <expr> as 'IS <expr.
```
Here is what postgres does
```sql
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)
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on issue #3159: Support "IS TRUE/FALSE" syntax
Posted by GitBox <gi...@apache.org>.
alamb commented on issue #3159:
URL: https://github.com/apache/arrow-datafusion/issues/3159#issuecomment-1215884332
@sarahyurick here is an example of doing something similar for `array`:
https://github.com/apache/arrow-datafusion/pull/3122/files#diff-c01a34949db6258aa1593f011ecf90f62cbde406acd5cdbf8b9b60b970ace1cfR2372-R2374
```rust
let fun = BuiltinScalarFunction::MakeArray;
// follow postgres convention and name result "array"
Ok(Expr::ScalarFunction { fun, args }.alias("array"))
```
So in other words you can probably do something like (untested):
```rust
Ok(binary_expr(left, Operator::IsNotDistinctFrom, right).alias("..."))
```
https://github.com/apache/arrow-datafusion/blob/ee55d89cbf20f4a6d17fe399c72d60dca6d67912/datafusion/expr/src/operator.rs#L59
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] sarahyurick commented on issue #3159: Support "IS TRUE/FALSE" syntax
Posted by GitBox <gi...@apache.org>.
sarahyurick commented on issue #3159:
URL: https://github.com/apache/arrow-datafusion/issues/3159#issuecomment-1215861994
Thanks for the response! I'll start working on this.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] andygrove closed issue #3159: Support "IS TRUE/FALSE" syntax
Posted by GitBox <gi...@apache.org>.
andygrove closed issue #3159: Support "IS TRUE/FALSE" syntax
URL: https://github.com/apache/arrow-datafusion/issues/3159
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org