Interface SqlAggregator
- All Known Implementing Classes:
ApproxCountDistinctSqlAggregator,ArrayConcatSqlAggregator,ArraySqlAggregator,AvgSqlAggregator,BitwiseSqlAggregator,BuiltinApproxCountDistinctSqlAggregator,CountSqlAggregator,EarliestLatestAnySqlAggregator,EarliestLatestBySqlAggregator,GroupingSqlAggregator,LiteralSqlAggregator,MaxSqlAggregator,MinSqlAggregator,SimpleSqlAggregator,SingleValueSqlAggregator,StringSqlAggregator,SumSqlAggregator,SumZeroSqlAggregator,WindowSqlAggregate
public interface SqlAggregator
Bridge between Druid and SQL aggregators.
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.calcite.sql.SqlAggFunctionReturns the SQL operator corresponding to this aggregation function.default AggregationtoDruidAggregation(PlannerContext plannerContext, RowSignature rowSignature, VirtualColumnRegistry virtualColumnRegistry, org.apache.calcite.rex.RexBuilder rexBuilder, String name, org.apache.calcite.rel.core.AggregateCall aggregateCall, org.apache.calcite.rel.core.Project project, List<Aggregation> existingAggregations, boolean finalizeAggregations) Returns a Druid Aggregation corresponding to a SQLAggregateCall.default AggregationtoDruidAggregation(PlannerContext plannerContext, VirtualColumnRegistry virtualColumnRegistry, String name, org.apache.calcite.rel.core.AggregateCall aggregateCall, InputAccessor inputAccessor, List<Aggregation> existingAggregations, boolean finalizeAggregations) Returns a Druid Aggregation corresponding to a SQLAggregateCall.
-
Method Details
-
calciteFunction
org.apache.calcite.sql.SqlAggFunction calciteFunction()Returns the SQL operator corresponding to this aggregation function. Should be a singleton.- Returns:
- operator
-
toDruidAggregation
@Nullable default Aggregation toDruidAggregation(PlannerContext plannerContext, VirtualColumnRegistry virtualColumnRegistry, String name, org.apache.calcite.rel.core.AggregateCall aggregateCall, InputAccessor inputAccessor, List<Aggregation> existingAggregations, boolean finalizeAggregations) Returns a Druid Aggregation corresponding to a SQLAggregateCall. This method should ignore filters; they will be applied to your aggregator in a later step.- Parameters:
plannerContext- SQL planner contextvirtualColumnRegistry- re-usable virtual column referencesname- desired output name of the aggregationaggregateCall- aggregate call objectinputAccessor- gives access to input fields and schemaexistingAggregations- existing aggregations for this query; useful for re-using aggregations. May be safely ignored if you do not want to re-use existing aggregations.finalizeAggregations- true if this query should include explicit finalization for all of its aggregators, where required. This is set for subqueries where Druid's native query layer does not do this automatically.- Returns:
- aggregation, or null if the call cannot be translated
-
toDruidAggregation
@Nullable default Aggregation toDruidAggregation(PlannerContext plannerContext, RowSignature rowSignature, VirtualColumnRegistry virtualColumnRegistry, org.apache.calcite.rex.RexBuilder rexBuilder, String name, org.apache.calcite.rel.core.AggregateCall aggregateCall, org.apache.calcite.rel.core.Project project, List<Aggregation> existingAggregations, boolean finalizeAggregations) Returns a Druid Aggregation corresponding to a SQLAggregateCall. This method should ignore filters; they will be applied to your aggregator in a later step.- Parameters:
plannerContext- SQL planner contextrowSignature- input row signaturevirtualColumnRegistry- re-usable virtual column referencesrexBuilder- a rexBuilder, in case you need onename- desired output name of the aggregationaggregateCall- aggregate call objectproject- project that should be applied before aggregation; may be nullexistingAggregations- existing aggregations for this query; useful for re-using aggregations. May be safely ignored if you do not want to re-use existing aggregations.finalizeAggregations- true if this query should include explicit finalization for all of its aggregators, where required. This is set for subqueries where Druid's native query layer does not do this automatically.- Returns:
- aggregation, or null if the call cannot be translated
-