Class WinAggResetContextImpl

All Implemented Interfaces:
AggResetContext, NestedBlockBuilder, WinAggFrameContext, WinAggResetContext

public class WinAggResetContextImpl extends AggResetContextImpl implements WinAggResetContext
Implementation of WinAggResetContext.
  • Constructor Details

    • WinAggResetContextImpl

      public WinAggResetContextImpl(BlockBuilder block, 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 initialization
      accumulator - accumulator variables that store the intermediate aggregate state
      index - index of the current row in the partition
      startIndex - index of the very first row in partition
      endIndex - index of the very last row in partition
      hasRows - boolean expression that tells if the partition has rows
      frameRowCount - number of rows in the current frame
      partitionRowCount - number of rows in the current partition
  • Method Details

    • 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 use WinAggFrameContext.startIndex() when you need zero-based row position.
      Specified by:
      index in interface WinAggFrameContext
      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 interface WinAggFrameContext
      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 interface WinAggFrameContext
      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 interface WinAggFrameContext
      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 interface WinAggFrameContext
      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 interface WinAggFrameContext
      Returns:
      number of rows in the current partition or 0 if the partition is empty