Skip to content

Commit 1c0e82b

Browse files
committed
Optimize code
1 parent 9c35ddd commit 1c0e82b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowExec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import org.apache.spark.sql.types.{CalendarIntervalType, DateType, IntegerType,
6262
* 1. [[FrameLessOffsetWindowFunction]] returns the value of the input column offset by a number
6363
* of rows according to the current row.
6464
* 2. [[UnboundedOffsetWindowFunctionFrame]] and [[UnboundedPrecedingOffsetWindowFunctionFrame]]
65-
* returns the value of the input column offset by a number of rows within the partition.
65+
* returns the value of the input column offset by a number of rows within the frame.
6666
*
6767
* Different frame boundaries can be used in Growing, Shrinking and Moving frames. A frame
6868
* boundary can be either Row or Range based:

sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowFunctionFrame.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class FrameLessOffsetWindowFunctionFrame(
178178
/**
179179
* The unbounded offset window frame is an internal window frame just used to optimize the
180180
* performance for the window function that returns the value of the input column offset
181-
* by a number of rows within the partition and has specified ROWS BETWEEN UNBOUNDED PRECEDING
181+
* by a number of rows within the frame and has specified ROWS BETWEEN UNBOUNDED PRECEDING
182182
* AND UNBOUNDED FOLLOWING. The internal window frame is not a popular window frame cannot be
183183
* specified and used directly by the users.
184184
* The unbounded offset window frame calculates frames containing NTH_VALUE statements.
@@ -220,7 +220,7 @@ class UnboundedOffsetWindowFunctionFrame(
220220
/**
221221
* The unbounded preceding offset window frame is an internal window frame just used to optimize
222222
* the performance for the window function that returns the value of the input column offset
223-
* by a number of rows within the partition and has specified ROWS BETWEEN UNBOUNDED PRECEDING
223+
* by a number of rows within the frame and has specified ROWS BETWEEN UNBOUNDED PRECEDING
224224
* AND CURRENT ROW. The internal window frame is not a popular window frame cannot be specified
225225
* and used directly by the users.
226226
* The unbounded preceding offset window frame calculates frames containing NTH_VALUE statements.
@@ -248,7 +248,7 @@ class UnboundedPrecedingOffsetWindowFunctionFrame(
248248
if (inputIterator.hasNext) inputIterator.next()
249249
inputIndex += 1
250250
}
251-
if (inputIndex >= 0 && inputIndex < input.length) {
251+
if (inputIndex < input.length) {
252252
selectedRow = WindowFunctionFrame.getNextOrNull(inputIterator)
253253
}
254254
}

0 commit comments

Comments
 (0)