Skip to content

Support boolean == boolean and boolean != boolean operators  #1159

@alamb

Description

@alamb

Describe the bug
I found this while working on #1153

Trying to do a boolean operation with eq or != results in an error such as:

ArrowError(ExternalError(Internal("Data type Boolean not supported for binary operation on dyn arrays")))

To Reproduce

echo "true" > /tmp/foo.csv
echo "false" >> /tmp/foo.csv

cargo run --bin datafusion-cli

Then run SQL:

CREATE EXTERNAL TABLE foo(x boolean)
STORED AS CSV
LOCATION '/tmp/foo.csv';

> select * from foo;
+-------+
| x     |
+-------+
| true  |
| false |
+-------+
2 rows in set. Query took 0.010 seconds.
> select x != x from foo;
ArrowError(ExternalError(Internal("Data type Boolean not supported for binary operation on dyn arrays")))

Expected behavior
Expect the query to run and the a result of two columns of false values

Additional context
The reason it is a problem for constant folding, is that there is special case code to handle constant true != false type expressions but it doesn't work with the general purpose constant evaluator.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions