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

    https://github.com/apache/spark/pull/16909#discussion_r105007318
  
    --- 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 --
    
    If we expect a row somewhere, I'd like to call next(), it will throw an 
exception if something goes wrong, otherwise you will silient got wrong result.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to