Interface OverWindowFrame
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
InsensitiveOverFrame,OffsetOverFrame,RangeSlidingOverFrame,RangeUnboundedFollowingOverFrame,RangeUnboundedPrecedingOverFrame,RowSlidingOverFrame,RowUnboundedFollowingOverFrame,RowUnboundedPrecedingOverFrame,SlidingOverFrame,UnboundedFollowingOverFrame,UnboundedOverWindowFrame,UnboundedPrecedingOverFrame
public interface OverWindowFrame extends Serializable
A window frame calculates the results for those records belong to a window frame. Before use a frame must be prepared by passing it all the records in the current partition. A frame is a subset of the current partition and the frame clause specifies how to define the subset. Frames are determined with respect to the current row, which enables a frame to move within a partition depending on the location of the current row within its partition. More information: https://docs.oracle.com/cd/E17952_01/mysql-8.0-en/window-functions-frames.htmlE.g.: SELECT d, e, f, sum(e) over (partition by d order by e rows between 5 PRECEDING and 2 FOLLOWING), -- frame 1 count(*) over (partition by d order by e desc rows between 6 PRECEDING and 2 FOLLOWING), -- frame 2 max(f) over (partition by d order by e rows between UNBOUNDED PRECEDING and CURRENT ROW), -- frame 3 min(h) over (partition by d order by e desc rows between CURRENT ROW and UNBOUNDED FOLLOWING), -- frame 4 h FROM Table5 The above sql has 4 frames.
Over AGG means that every Row has a corresponding output. OverWindowFrame is called by: 1.Get all data and invoke
prepare(ResettableExternalBuffer)for partition 2.Then each Row is traversed one by one to invokeprocess(int, RowData)to get the calculation results of the currentRow.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static org.apache.flink.table.data.binary.BinaryRowDatagetNextOrNull(ResettableExternalBuffer.BufferIterator iterator)Get next row from iterator.voidopen(ExecutionContext ctx)Open to init withExecutionContext.voidprepare(ResettableExternalBuffer rows)Prepare for next partition.org.apache.flink.table.data.RowDataprocess(int index, org.apache.flink.table.data.RowData current)return the ACC of the window frame.
-
-
-
Method Detail
-
open
void open(ExecutionContext ctx) throws Exception
Open to init withExecutionContext.- Throws:
Exception
-
prepare
void prepare(ResettableExternalBuffer rows) throws Exception
Prepare for next partition.- Throws:
Exception
-
process
org.apache.flink.table.data.RowData process(int index, org.apache.flink.table.data.RowData current) throws Exceptionreturn the ACC of the window frame.- Throws:
Exception
-
getNextOrNull
static org.apache.flink.table.data.binary.BinaryRowData getNextOrNull(ResettableExternalBuffer.BufferIterator iterator)
Get next row from iterator. Return null if iterator has no next. TODO Maybe copy is repeated.
-
-