Package org.apache.calcite.sql
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 TypeMethodDescriptionsingleton(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
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)isxMIN(x)isxMAX(x)isxCOUNT(x)isCASE WHEN x IS NOT NULL THEN 1 ELSE 0 END 1which can be simplified to1ifxis never nullCOUNT(*)is 1GROUPING(deptno)if 0 ifdeptnois being grouped, 1 otherwise
- Parameters:
rexBuilder- Rex builderinputRowType- Input row typeaggregateCall- Aggregate call- Returns:
- Expression for single row
-