Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16909#discussion_r105001564
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowFunctionFrame.scala
 ---
    @@ -341,25 +364,27 @@ private[window] final class 
UnboundedFollowingWindowFunctionFrame(
       override def write(index: Int, current: InternalRow): Unit = {
         var bufferUpdated = index == 0
     
    -    // Duplicate the input to have a new iterator
    -    val tmp = input.copy()
    -
    -    // Drop all rows from the buffer for which the input row value is 
smaller than
    +    // Ignore all the rows from the buffer for which the input row value 
is smaller than
         // the output row lower bound.
    -    tmp.skip(inputIndex)
    -    var nextRow = tmp.next()
    +    val iterator = input.generateIterator(startIndex = inputIndex)
    +
    +    def getNextOrNull(iterator: Iterator[UnsafeRow]): UnsafeRow = {
    --- End diff --
    
    NIT: Perhaps add this to the iterator class? Since we are using a similar 
construct in more than one place.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to