alamb opened a new issue #1156:
URL: https://github.com/apache/arrow-datafusion/issues/1156


   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   Sometimes it is useful to use a `CASE` statement to evaluate predicates 
within a project operation
   
   **Describe the solution you'd like**
   
   I would like to be able to create a `CASE` statement that has a boolean 
result
   
   For example the following query should return `false` but instead returns a 
runtime error:
   
   ```
   > explain select case when 'cpu' != 'cpu' then true else false end;
   Execution("CASE does not support 'Boolean'")
   ```
   
   A workaround is to use a different type like string:
   ```
   > explain select case when 'cpu' != 'cpu' then 'yes' else 'no' end;
   +---------------+-----------------------------------------+
   | plan_type     | plan                                    |
   +---------------+-----------------------------------------+
   | logical_plan  | Projection: Utf8("no")                  |
   |               |   EmptyRelation                         |
   | physical_plan | ProjectionExec: expr=[no as Utf8("no")] |
   |               |   EmptyExec: produce_one_row=true       |
   |               |                                         |
   +---------------+-----------------------------------------+
   2 rows in set. Query took 0.003 seconds.
   ```
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to