beliefer commented on a change in pull request #28685:
URL: https://github.com/apache/spark/pull/28685#discussion_r469835363
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowFunctionFrame.scala
##########
@@ -151,10 +168,41 @@ final class OffsetWindowFunctionFrame(
}
inputIndex += 1
}
+}
- override def currentLowerBound(): Int = throw new
UnsupportedOperationException()
+/**
+ * The fixed offset window frame calculates frames containing
+ * NTH_VALUE statements.
+ * The fixed offset window frame return the same value for all rows in the
window partition.
+ */
+class FixedOffsetWindowFunctionFrame(
+ target: InternalRow,
+ ordinal: Int,
+ expressions: Array[OffsetWindowFunction],
+ inputSchema: Seq[Attribute],
+ newMutableProjection: (Seq[Expression], Seq[Attribute]) =>
MutableProjection,
+ offset: Int)
+ extends OffsetWindowFunctionFrameBase(
+ target, ordinal, expressions, inputSchema, newMutableProjection, offset) {
- override def currentUpperBound(): Int = throw new
UnsupportedOperationException()
+ var maybeRow: Option[UnsafeRow] = None
+
+ override def prepare(rows: ExternalAppendOnlyUnsafeRowArray): Unit = {
+ super.prepare(rows)
+ if (inputIndex >= 0 && inputIndex < input.length) {
+ val r = WindowFunctionFrame.getNextOrNull(inputIterator)
+ maybeRow = Some(r)
+ }
+ }
+
+ override def write(index: Int, current: InternalRow): Unit = {
Review comment:
OK
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]