WindowFunctionFrame¶
WindowFunctionFrame
is a <
[[implementations]] .WindowFunctionFrame's Implementations [width="100%",cols="1,2",options="header"] |=== | Name | Description
OffsetWindowFunctionFrame |
---|
[[SlidingWindowFunctionFrame]] SlidingWindowFunctionFrame |
---|
UnboundedFollowingWindowFunctionFrame |
---|
UnboundedPrecedingWindowFunctionFrame |
---|
< |
---|
=== |
=== [[UnboundedWindowFunctionFrame]] UnboundedWindowFunctionFrame
UnboundedWindowFunctionFrame
is a WindowFunctionFrame that gives the same value for every row in a partition.
UnboundedWindowFunctionFrame
is created for AggregateFunctions (in AggregateExpressions) or AggregateWindowFunctions with no frame defined (i.e. no rowsBetween
or rangeBetween
) that boils down to using the WindowExec.md#entire-partition-frame[entire partition frame].
[[UnboundedWindowFunctionFrame-creating-instance]] UnboundedWindowFunctionFrame
takes the following when created:
- [[UnboundedWindowFunctionFrame-target]] Target InternalRow
- [[UnboundedWindowFunctionFrame-processor]] AggregateProcessor
==== [[UnboundedWindowFunctionFrame-prepare]] prepare
Method
[source, scala]¶
prepare(rows: ExternalAppendOnlyUnsafeRowArray): Unit¶
prepare
requests AggregateProcessor to initialize passing in the number of UnsafeRows
in the input ExternalAppendOnlyUnsafeRowArray
.
prepare
then requests ExternalAppendOnlyUnsafeRowArray
to generate an interator.
In the end, prepare
requests AggregateProcessor to update passing in every UnsafeRow
in the iterator one at a time.
==== [[UnboundedWindowFunctionFrame-write]] write
Method
[source, scala]¶
write(index: Int, current: InternalRow): Unit¶
write
simply requests <
=== [[contract]] WindowFunctionFrame Contract
[source, scala]¶
package org.apache.spark.sql.execution.window
abstract class WindowFunctionFrame { def prepare(rows: ExternalAppendOnlyUnsafeRowArray): Unit def write(index: Int, current: InternalRow): Unit }
NOTE: WindowFunctionFrame
is a private[window]
contract.
.WindowFunctionFrame Contract [cols="1,2",options="header",width="100%"] |=== | Method | Description
| [[prepare]] prepare
| Used when WindowExec
operator fetches all UnsafeRows for a partition (passing in ExternalAppendOnlyUnsafeRowArray with all UnsafeRows
).
| [[write]] write
| Used when the [IteratorInternalRow] (from executing WindowExec
) is requested a next row |===