Interface SqlSplittableAggFunction

    • Method Detail

      • other

        AggregateCall other​(RelDataTypeFactory typeFactory,
                            AggregateCall e)
        Called to generate an aggregate for the other side of the join than the side aggregate call's arguments come from. Returns null if no aggregate is required.
      • topSplit

        AggregateCall topSplit​(RexBuilder rexBuilder,
                               SqlSplittableAggFunction.Registry<RexNode> extra,
                               int offset,
                               RelDataType inputRowType,
                               AggregateCall aggregateCall,
                               int leftSubTotal,
                               int rightSubTotal)
        Generates an aggregate call to merge sub-totals.

        Most implementations will add a single aggregate call to aggCalls, and return a RexInputRef that points to it.

        Parameters:
        rexBuilder - Rex builder
        extra - Place to define extra input expressions
        offset - Offset due to grouping columns (and indicator columns if applicable)
        inputRowType - Input row type
        aggregateCall - Source aggregate call
        leftSubTotal - Ordinal of the sub-total coming from the left side of the join, or -1 if there is no such sub-total
        rightSubTotal - Ordinal of the sub-total coming from the right side of the join, or -1 if there is no such sub-total
        Returns:
        Aggregate call
      • singleton

        RexNode singleton​(RexBuilder rexBuilder,
                          RelDataType inputRowType,
                          AggregateCall aggregateCall)
        Generates an expression for the value of the aggregate function when applied to a single row.

        For example, if there is one row:

        • SUM(x) is x
        • MIN(x) is x
        • MAX(x) is x
        • COUNT(x) is CASE WHEN x IS NOT NULL THEN 1 ELSE 0 END 1 which can be simplified to 1 if x is never null
        • COUNT(*) is 1
        Parameters:
        rexBuilder - Rex builder
        inputRowType - Input row type
        aggregateCall - Aggregate call
        Returns:
        Expression for single row