public interface OverWindowFrame extends Serializable
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.
Modifier and Type | Method and Description |
---|---|
static BinaryRowData |
getNextOrNull(ResettableExternalBuffer.BufferIterator iterator)
Get next row from iterator.
|
void |
open(ExecutionContext ctx)
Open to init with
ExecutionContext . |
void |
prepare(ResettableExternalBuffer rows)
Prepare for next partition.
|
RowData |
process(int index,
RowData current)
return the ACC of the window frame.
|
void open(ExecutionContext ctx) throws Exception
ExecutionContext
.Exception
void prepare(ResettableExternalBuffer rows) throws Exception
Exception
RowData process(int index, RowData current) throws Exception
Exception
static BinaryRowData getNextOrNull(ResettableExternalBuffer.BufferIterator iterator)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.