Interface OverWindowFrame
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
InsensitiveOverFrame,OffsetOverFrame,RangeSlidingOverFrame,RangeUnboundedFollowingOverFrame,RangeUnboundedPrecedingOverFrame,RowSlidingOverFrame,RowUnboundedFollowingOverFrame,RowUnboundedPrecedingOverFrame,SlidingOverFrame,UnboundedFollowingOverFrame,UnboundedOverWindowFrame,UnboundedPrecedingOverFrame
E.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 invoke process(int, RowData) to get the calculation results of
the currentRow.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.flink.table.data.binary.BinaryRowDataGet next row from iterator.voidopen(ExecutionContext ctx) Open to init withExecutionContext.voidPrepare 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 Details
-
open
Open to init withExecutionContext.- Throws:
Exception
-
prepare
Prepare for next partition.- Throws:
Exception
-
process
org.apache.flink.table.data.RowData process(int index, org.apache.flink.table.data.RowData current) throws Exception return 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.
-