Class Aggregations
java.lang.Object
org.apache.druid.sql.calcite.aggregation.Aggregations
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<DruidExpression>getArgumentsForSimpleAggregator(PlannerContext plannerContext, org.apache.calcite.rel.core.AggregateCall call, InputAccessor inputAccessor) Get Druid expressions that correspond to "simple" aggregator inputs.static DruidExpressiontoDruidExpressionForNumericAggregator(PlannerContext plannerContext, RowSignature rowSignature, org.apache.calcite.rex.RexNode rexNode) Translate a CalciteRexNodeto a Druid expression for the aggregators that require numeric type inputs.
-
Method Details
-
getArgumentsForSimpleAggregator
@Nullable public static List<DruidExpression> getArgumentsForSimpleAggregator(PlannerContext plannerContext, org.apache.calcite.rel.core.AggregateCall call, InputAccessor inputAccessor) Get Druid expressions that correspond to "simple" aggregator inputs. This is used by standard sum/min/max aggregators, which have the following properties: 1) They can take direct field accesses or expressions as inputs. 2) They cannot implicitly cast strings to numbers when using a direct field access.- Parameters:
plannerContext- SQL planner contextcall- aggregate call objectinputAccessor- gives access to input fields and schema- Returns:
- list of expressions corresponding to aggregator arguments, or null if any cannot be translated
-
toDruidExpressionForNumericAggregator
public static DruidExpression toDruidExpressionForNumericAggregator(PlannerContext plannerContext, RowSignature rowSignature, org.apache.calcite.rex.RexNode rexNode) Translate a CalciteRexNodeto a Druid expression for the aggregators that require numeric type inputs. The returned expression can keep an explicit cast from strings to numbers when the column consumed by the expression is the string type. Consider usingExpressions.toDruidExpression(PlannerContext, RowSignature, RexNode)for projections or the aggregators that don't require numeric inputs.- Parameters:
plannerContext- SQL planner contextrowSignature- signature of the rows to be extracted fromrexNode- expression meant to be applied on top of the rows- Returns:
- DruidExpression referring to fields in rowOrder, or null if not possible to translate
-