ahshahid commented on code in PR #50757:
URL: https://github.com/apache/spark/pull/50757#discussion_r2070588096


##########
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:
   The points which I mentioned hold true or not is what I am trying to 
validate..
    The cost of calculating if a QueryPlan node is inDeterministic or not will 
trickle down to the leaf... and because at least in Planner stage , its Plan's 
which are manipulated, the inDeterrministic identification will require tree 
travesal to leaf ... In case of Expression's , it does not cross the QyeryPlan 
node boundary.



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

Reply via email to