rich7420 commented on code in PR #7456:
URL: https://github.com/apache/datafusion-comet/pull/7456#discussion_r4484896581


##########
native/spark-expr/src/conditional_funcs/lazy_logical.rs:
##########
@@ -191,7 +193,11 @@ fn is_deterministic(expr: &Arc<dyn PhysicalExpr>) -> bool {
         || expr.is::<IfExpr>()
         || expr
             .downcast_ref::<ScalarFunctionExpr>()
-            .is_some_and(|f| f.fun().signature().volatility == 
Volatility::Immutable);
+            .is_some_and(|f| f.fun().signature().volatility == 
Volatility::Immutable)
+        // Its children are those of the function it wraps
+        || expr
+            .downcast_ref::<NullShortCircuit>()
+            .is_some_and(|n| is_deterministic(n.inner()));

Review Comment:
   Nested ANSI arithmetic doubles determinism work at each wrapper: `n.inner()` 
and the final `all` visit the same children. My 18-level helper probe counted 
1,310,716 visits. Return the inner result directly.



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