Class WinAggResultContextImpl

    • Constructor Detail

      • WinAggResultContextImpl

        public WinAggResultContextImpl​(BlockBuilder block,
                                       java.util.List<Expression> accumulator,
                                       java.util.function.Function<BlockBuilder,​WinAggFrameResultContext> frameContextBuilder)
        Creates window aggregate result context.
        Parameters:
        block - code block that will contain the added initialization
        accumulator - accumulator variables that store the intermediate aggregate state
    • Method Detail

      • arguments

        public final java.util.List<Expression> arguments​(Expression rowIndex)
        Description copied from interface: WinAggResultContext
        Returns Linq4j form of arguments. The resulting value is equivalent to rowTranslator().translateList(rexArguments()). This is handy if you need just operate on argument.
        Specified by:
        arguments in interface WinAggResultContext
        Parameters:
        rowIndex - index of the requested row. The index must be in range of partition's startIndex and endIndex.
        Returns:
        Linq4j form of arguments of the particular row
      • rowInFrame

        public Expression rowInFrame​(Expression rowIndex)
        Description copied from interface: WinAggFrameResultContext
        Returns boolean the expression that checks if the given index is in the frame bounds.
        Specified by:
        rowInFrame in interface WinAggFrameResultContext
        Parameters:
        rowIndex - index if the row to check
        Returns:
        expression that validates frame bounds for the given index
      • rowInPartition

        public Expression rowInPartition​(Expression rowIndex)
        Description copied from interface: WinAggFrameResultContext
        Returns boolean the expression that checks if the given index is in the partition bounds.
        Specified by:
        rowInPartition in interface WinAggFrameResultContext
        Parameters:
        rowIndex - index if the row to check
        Returns:
        expression that validates partition bounds for the given index
      • compareRows

        public Expression compareRows​(Expression a,
                                      Expression b)
        Description copied from interface: WinAggFrameResultContext
        Compares two rows given by absolute positions according to the order collation of the current window.
        Specified by:
        compareRows in interface WinAggFrameResultContext
        Parameters:
        a - absolute index of the first row
        b - absolute index of the second row
        Returns:
        result of comparison as as in Comparable.compareTo(T)
      • 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