apache / datafusion

Apache DataFusion SQL Query Engine
https://datafusion.apache.org/
Apache License 2.0
5.48k stars 1.02k forks source link

Add type coercion/validation for `Is[Not]True` and similar statements #3304

Open andygrove opened 1 year ago

andygrove commented 1 year ago

Is your feature request related to a problem or challenge? Please describe what you are trying to do. Once https://github.com/apache/arrow-datafusion/pull/3301 and https://github.com/apache/arrow-datafusion/pull/3222 are merged, let's add type validation for IsTrue/False/Unknown to ensure that the left expr is a boolean.

Describe the solution you'd like As above

Describe alternatives you've considered None

Additional context None

liukun4515 commented 1 year ago

@andygrove we should follow this doc from PG https://www.postgresql.org/docs/current/functions-comparison.html

liukun4515 commented 1 year ago

The left expr must be BOOLEAN DATA TYPE, and can't be casted to the boolean type