Pajaraja commented on code in PR #50957:
URL: https://github.com/apache/spark/pull/50957#discussion_r2101885084


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/UnionLoopExec.scala:
##########
@@ -183,11 +183,24 @@ case class UnionLoopExec(
     // Main loop for obtaining the result of the recursive query.
     while (prevCount > 0 && !limitReached) {
       var prevPlan: LogicalPlan = null
+
+      // If the recursive part contains non-deterministic expressions that 
depends on a seed, we
+      // need to create a new seed since the seed for this expression is set 
in the analysis, and
+      // we avoid re-triggering the analysis for every iterative step.
+      val recursionReseeded = if (recursion.deterministic) {
+        recursion
+      } else {
+        recursion.transformExpressionsDown {
+          case e: ExpressionWithRandomSeed =>
+            e.withShiftedSeed(currentLevel)

Review Comment:
   It starts with 1.



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