Skip to content

Can not use between in the select list:  #1196

@alamb

Description

@alamb

Describe the bug
I can not write a query that uses between in the select list of a sql query

To Reproduce

echo "1" > /tmp/foo.csv
cargo run -p datafusion-cli
CREATE EXTERNAL TABLE foo(x int)
STORED AS CSV
LOCATION '/tmp/foo.csv';
> select 1 between 5 and 10;
NotImplemented("Create name does not support logical expression Utf8(NULL) BETWEEN Int64(5) AND Utf8(NULL)")

> select 1 between 5 and 10 from foo;
NotImplemented("Create name does not support logical expression Int64(1) BETWEEN Int64(5) AND Int64(10)")

Expected behavior
I expect a single row false to be returned

Workaround
Use an alias:

> select 1 between 5 and 10 as my_expr;
+---------+
| my_expr |
+---------+
| false   |
+---------+
1 row in set. Query took 0.002 seconds.
> select 1 between 5 and 10 as my_expr from foo;
+---------+
| my_expr |
+---------+
| false   |
+---------+
1 row in set. Query took 0.011 seconds.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions