Class SimpleSqlAggregator
java.lang.Object
org.apache.druid.sql.calcite.aggregation.builtin.SimpleSqlAggregator
- All Implemented Interfaces:
SqlAggregator
- Direct Known Subclasses:
MaxSqlAggregator,MinSqlAggregator,SingleValueSqlAggregator,SumSqlAggregator
Abstraction for single column, single argument simple aggregators like sum, avg, min, max that:
1) Can take direct field accesses or expressions as inputs.
2) Cannot implicitly cast strings to numbers when using a direct field access.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DruidExceptionbadTypeException(String columnName, String agg, ColumnType type) 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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.sql.calcite.aggregation.SqlAggregator
calciteFunction, toDruidAggregation
-
Constructor Details
-
SimpleSqlAggregator
public SimpleSqlAggregator()
-
-
Method Details
-
badTypeException
-
toDruidAggregation
@Nullable public Aggregation toDruidAggregation(PlannerContext plannerContext, VirtualColumnRegistry virtualColumnRegistry, String name, org.apache.calcite.rel.core.AggregateCall aggregateCall, InputAccessor inputAccessor, List<Aggregation> existingAggregations, boolean finalizeAggregations) Description copied from interface:SqlAggregatorReturns a Druid Aggregation corresponding to a SQLAggregateCall. This method should ignore filters; they will be applied to your aggregator in a later step.- Specified by:
toDruidAggregationin interfaceSqlAggregator- 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
-