simonvandel commented on PR #19732:
URL: https://github.com/apache/datafusion/pull/19732#issuecomment-3733423561

   CI found an error using the sqlite test suite:
   ```
   External error: 1 errors in file 
/__w/datafusion/datafusion/datafusion-testing/data/sqlite/random/expr/slt_good_102.slt
   
   1. query is expected to fail, but actually succeed:
   [SQL] SELECT 57 * - - 12 * + + 83 + - 74 + - + CASE + ( COUNT ( * ) ) WHEN + 
60 THEN + CAST ( NULL AS INTEGER ) ELSE NULL END + COUNT ( ALL - 4 + 61 / 0 ) * 
29 * 28
   at 
/__w/datafusion/datafusion/datafusion-testing/data/sqlite/random/expr/slt_good_102.slt:8867
   ```
   
   Makes sense that we should not remove case expressions that could cause 
runtime-failures (divide by zero error in this case).
   
   The question is how to detect if an expression could cause a side effect.
   I couldn't find any `Expr::side_effect_free` (or `Expr::has_side_effect`). 
Am I missing something? Does anyone have ideas on how this could be handled?
   We could of course restrict this optimization to only apply to simpler 
expressions like literals or columns, but it would be cool if we could apply 
this optimization more generally


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