rluvaton commented on PR #18183:
URL: https://github.com/apache/datafusion/pull/18183#issuecomment-3568178298

   > I think I figured out what might be the problem. 
`try_creating_lookup_table` assumes that the type of the literals will match 
exactly with the type of the evaluated `case` expression. I don't know if you 
can count on that always being so. `Utf8` literals combined with `Dictionary` 
or `REE` encoded expression arrays seems plausible.
   
   Weird, I have a check before that to only use the optimization if all types 
are the same: 
   
   
https://github.com/apache/datafusion/pull/18183/files#diff-67c7721a5e7682575981b9ea758d31694d93b03618799bbf7a598cc7fc0dc42aR164-R184:
   
   ```rust
   {
       let data_type = when[0].data_type();
   
       // If not all the WHEN literals are the same data type we cannot use 
this optimization
       if when.iter().any(|l| l.data_type() != data_type) {
           return None;
       }
   }
   
   {
       let data_type = then[0].data_type();
   
       // If not all the then and the else literals are the same data type we 
cannot use this optimization
       if then.iter().any(|l| l.data_type() != data_type) {
           return None;
       }
   
       if else_value.data_type() != data_type {
           return None;
       }
   }
   ```
   
   aligned with main, waiting to see if it's failing in CI or not


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