beliefer commented on a change in pull request #27440: [SPARK-27951][SQL]
Support ANSI SQL NTH_VALUE window function
URL: https://github.com/apache/spark/pull/27440#discussion_r377551709
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowFunctionFrame.scala
##########
@@ -157,6 +157,38 @@ final class OffsetWindowFunctionFrame(
override def currentUpperBound(): Int = throw new
UnsupportedOperationException()
}
+class FixedOffsetWindowFunctionFrame(
+ target: InternalRow,
+ ordinal: Int,
+ expressions: Array[OffsetWindowFunction],
+ inputSchema: Seq[Attribute],
+ newMutableProjection: (Seq[Expression], Seq[Attribute]) =>
MutableProjection,
+ offset: Int)
+ extends OffsetWindowFunctionFrame(
+ target, ordinal, expressions, inputSchema, newMutableProjection, offset) {
+
+ override def prepare(rows: ExternalAppendOnlyUnsafeRowArray): Unit = {
+ input = rows
+ inputIndex = 0
+ }
+
+ override def write(index: Int, current: InternalRow): Unit = {
Review comment:
I have optimized the code so that the skip operator runs once in `prepare`.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]