fornwall commented on PR #23691:
URL: https://github.com/apache/datafusion/pull/23691#issuecomment-5354346187

   > No API or query-result changes
   
   Actually, this seems to nicely fix a correctness bug I encountered.
   
   On current `main`, this:
   
   ```sql
   SELECT COUNT(*) FILTER (
     WHERE s = named_struct('a', 1) AND s['a'] = 0
   ) AS mixed_draws
   FROM (
     SELECT CASE WHEN random() < 0.5
       THEN named_struct('a', 0)
       ELSE named_struct('a', 1)
     END AS s
     FROM generate_series(1, 20000)
   );
   ```
   
   matches around 25% of rows, which is incorrect (both `s = named_struct('a', 
1)` and `s['a'] = 0` cannot be true).
   
   Setting `datafusion.optimizer.enable_leaf_expression_pushdown = false` gives 
the expected count of zero.
   
   Perhaps add an end-to-end `random()` regression test like this?


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