sdf-jkl commented on PR #20051:
URL: https://github.com/apache/datafusion/pull/20051#issuecomment-3830167843

   @comphead The issue with existing inlist_simplifier.rs is this guard:
   ```rust
           }) = expr
               && !list.is_empty()
               && (
                   // For lists with only 1 value we allow more complex 
expressions to be simplified
                   // e.g SUBSTR(c1, 2, 3) IN ('1') -> SUBSTR(c1, 2, 3) = '1'
                   // for more than one we avoid repeating this potentially 
expensive
                   // expressions
                   list.len() == 1
                       || list.len() <= THRESHOLD_INLINE_INLIST
                           && expr.try_as_col().is_some() // <--- this point 
here
               )
   ```
   When `list.len()` is greater than 1, we only perform this simplification if 
`lhs` is a `Column` expression. Expressions where the column wrapped in a 
function are  not handled.
   
   I was thinking about adding support inside `inlist_simplifier.rs`, but there 
is a precedent for handling `InList` support inside `expr_simplifier.rs` for 
`unwrap_cast`. If move `unwrap_cast` and `preimage` `InList` support here, we'd 
have to have another guard checking which function is being passed. Currently, 
the only way is by matching function name, which isn't neat.
   
   There is an issue for that:
   - #18643


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