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)
isx
MIN(x)
isx
MAX(x)
isx
COUNT(x)
isCASE WHEN x IS NOT NULL THEN 1 ELSE 0 END 1
which can be simplified to1
ifx
is never nullCOUNT(*)
is 1GROUPING(deptno)
if 0 ifdeptno
is being grouped, 1 otherwise
- Parameters:
rexBuilder
- Rex builderinputRowType
- Input row typeaggregateCall
- Aggregate call- Returns:
- Expression for single row
-