-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
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.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers