cloud-fan commented on a change in pull request #27558: 
[SPARK-30806][SQL]Evaluate once per group in UnboundedWindowFunctionFrame
URL: https://github.com/apache/spark/pull/27558#discussion_r378872179
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowFunctionFrame.scala
 ##########
 @@ -284,9 +284,7 @@ final class UnboundedWindowFunctionFrame(
 
   /** Write the frame columns for the current row to the given target row. */
   override def write(index: Int, current: InternalRow): Unit = {
-    // Unfortunately we cannot assume that evaluation is deterministic. So we 
need to re-evaluate
-    // for each row.
-    if (processor != null) {
+    if (processor != null && (index == 0)) {
 
 Review comment:
   so unbounded window frame means we only need to calculate result once and 
always return the result for each input row?
   
   Then shall we call `processor.evaluate(target)` in `prepare` and do nothing 
in `write`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to