pepijnve commented on issue #27631:
URL: https://github.com/apache/datafusion/issues/27631#issuecomment-7063260784

   My work on `case` has probably biased my thinking a bit 😄 `lower` is a 
relatively cheap function. In a more general situation the second branch might 
be prohibitively expensive to evaluate for each row though. Could an 
optimisation that turns the pattern you're describing into something like this 
help?
   
   ```
   Filter: case conditions1 when 0 then v = 'x when 1 then v = 'y' when 2 then 
v = 'z' end
     Projection: lower(t.s) AS v, *
       Filter: condition1 is not null
         Projection: case upper(t.s) when A then 0 when B then 1 when C then 2 
end AS condition1, *
           TableScan: t projection=[s]
   ```
   
   This would dovetail nicely with the #26609 and #27586 which are trying to 
make lookup table `case` expressions quite cheap.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to