ahshahid commented on code in PR #50757: URL: https://github.com/apache/spark/pull/50757#discussion_r2070581649
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/QueryPlan.scala: ########## @@ -103,13 +103,21 @@ abstract class QueryPlan[PlanType <: QueryPlan[PlanType]] AttributeSet(expressions) -- producedAttributes) /** - * Returns true when the all the expressions in the current node as well as all of its children + * Returns true when the current node (all the expressions in it) is deterministic. + */ + def deterministicNode: Boolean = _deterministicNode() + + private val _deterministicNode = + new BestEffortLazyVal[JBoolean](() => expressions.forall(_.deterministic)) + + /** + * Returns true when all the expressions in the current node as well as all of its children * are deterministic */ def deterministic: Boolean = _deterministic() - private val _deterministic = new BestEffortLazyVal[JBoolean](() => - expressions.forall(_.deterministic) && children.forall(_.deterministic)) + private val _deterministic = + new BestEffortLazyVal[JBoolean](() => deterministicNode && children.forall(_.deterministic)) Review Comment: I did not want to broach Union thing , ie. fraught with inconsistency not only in this aspect, but even canonicalization aspect etc... But the Union issue you are mentioning can be easily handled, regrading the hasInDeterminism by considering all legs... so I dont think that is a blocker. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org