Interface SqlSingletonAggFunction

All Known Subinterfaces:
SqlSplittableAggFunction
All Known Implementing Classes:
SqlSplittableAggFunction.AbstractSumSplitter, SqlSplittableAggFunction.CountSplitter, SqlSplittableAggFunction.SelfSplitter, SqlSplittableAggFunction.Sum0Splitter, SqlSplittableAggFunction.SumSplitter

public interface SqlSingletonAggFunction
Aggregate function that knows how to convert itself to a scalar value when applied to a single row.
  • Method Summary

    Modifier and Type
    Method
    Description
    singleton(RexBuilder rexBuilder, RelDataType inputRowType, AggregateCall aggregateCall)
    Generates an expression for the value of the aggregate function when applied to a single row.
  • Method Details

    • 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
      • GROUPING(deptno) if 0 if deptno is being grouped, 1 otherwise
      Parameters:
      rexBuilder - Rex builder
      inputRowType - Input row type
      aggregateCall - Aggregate call
      Returns:
      Expression for single row