Class WinAggResetContextImpl
- java.lang.Object
-
- org.apache.calcite.adapter.enumerable.NestedBlockBuilderImpl
-
- org.apache.calcite.adapter.enumerable.impl.AggResetContextImpl
-
- org.apache.calcite.adapter.enumerable.impl.WinAggResetContextImpl
-
- All Implemented Interfaces:
AggResetContext
,NestedBlockBuilder
,WinAggFrameContext
,WinAggResetContext
public class WinAggResetContextImpl extends AggResetContextImpl implements WinAggResetContext
Implementation ofWinAggResetContext
.
-
-
Field Summary
Fields Modifier and Type Field Description private Expression
endIndex
private Expression
frameRowCount
private Expression
hasRows
private Expression
index
private Expression
partitionRowCount
private Expression
startIndex
-
Constructor Summary
Constructors Constructor Description WinAggResetContextImpl(BlockBuilder block, java.util.List<Expression> accumulator, Expression index, Expression startIndex, Expression endIndex, Expression hasRows, Expression frameRowCount, Expression partitionRowCount)
Creates window aggregate reset context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expression
endIndex()
Returns the index of the very last row in partition.Expression
getFrameRowCount()
Returns the number of rows in the current frame (subject to framing clause).Expression
getPartitionRowCount()
Returns the number of rows in the current partition (as determined by PARTITION BY clause).Expression
hasRows()
Returns the boolean expression that tells if the partition has rows.Expression
index()
Returns the index of the current row in the partition.Expression
startIndex()
Returns the index of the very first row in partition.-
Methods inherited from class org.apache.calcite.adapter.enumerable.impl.AggResetContextImpl
accumulator, call
-
Methods inherited from class org.apache.calcite.adapter.enumerable.NestedBlockBuilderImpl
currentBlock, currentNullables, exitBlock, nestBlock, nestBlock, nestBlock
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.calcite.adapter.enumerable.AggResetContext
accumulator
-
Methods inherited from interface org.apache.calcite.adapter.enumerable.NestedBlockBuilder
currentBlock, currentNullables, exitBlock, nestBlock, nestBlock, nestBlock
-
-
-
-
Field Detail
-
index
private final Expression index
-
startIndex
private final Expression startIndex
-
endIndex
private final Expression endIndex
-
frameRowCount
private final Expression frameRowCount
-
partitionRowCount
private final Expression partitionRowCount
-
hasRows
private final Expression hasRows
-
-
Constructor Detail
-
WinAggResetContextImpl
public WinAggResetContextImpl(BlockBuilder block, java.util.List<Expression> accumulator, Expression index, Expression startIndex, Expression endIndex, Expression hasRows, Expression frameRowCount, Expression partitionRowCount)
Creates window aggregate reset context.- Parameters:
block
- code block that will contain the added initializationaccumulator
- accumulator variables that store the intermediate aggregate stateindex
- index of the current row in the partitionstartIndex
- index of the very first row in partitionendIndex
- index of the very last row in partitionhasRows
- boolean expression that tells if the partition has rowsframeRowCount
- number of rows in the current framepartitionRowCount
- number of rows in the current partition
-
-
Method Detail
-
index
public Expression index()
Description copied from interface:WinAggFrameContext
Returns the index of the current row in the partition. In other words, it is close to ~ROWS BETWEEN CURRENT ROW. Note to useWinAggFrameContext.startIndex()
when you need zero-based row position.- Specified by:
index
in interfaceWinAggFrameContext
- Returns:
- the index of the very first row in partition
-
startIndex
public Expression startIndex()
Description copied from interface:WinAggFrameContext
Returns the index of the very first row in partition.- Specified by:
startIndex
in interfaceWinAggFrameContext
- Returns:
- index of the very first row in partition
-
endIndex
public Expression endIndex()
Description copied from interface:WinAggFrameContext
Returns the index of the very last row in partition.- Specified by:
endIndex
in interfaceWinAggFrameContext
- Returns:
- index of the very last row in partition
-
hasRows
public Expression hasRows()
Description copied from interface:WinAggFrameContext
Returns the boolean expression that tells if the partition has rows. The partition might lack rows in cases like ROWS BETWEEN 1000 PRECEDING AND 900 PRECEDING.- Specified by:
hasRows
in interfaceWinAggFrameContext
- Returns:
- boolean expression that tells if the partition has rows
-
getFrameRowCount
public Expression getFrameRowCount()
Description copied from interface:WinAggFrameContext
Returns the number of rows in the current frame (subject to framing clause).- Specified by:
getFrameRowCount
in interfaceWinAggFrameContext
- Returns:
- number of rows in the current partition or 0 if the partition is empty
-
getPartitionRowCount
public Expression getPartitionRowCount()
Description copied from interface:WinAggFrameContext
Returns the number of rows in the current partition (as determined by PARTITION BY clause).- Specified by:
getPartitionRowCount
in interfaceWinAggFrameContext
- Returns:
- number of rows in the current partition or 0 if the partition is empty
-
-