Class Aggregations

java.lang.Object
org.apache.druid.sql.calcite.aggregation.Aggregations

public class Aggregations extends Object
  • 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 context
      call - aggregate call object
      inputAccessor - 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 Calcite RexNode to 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 using Expressions.toDruidExpression(PlannerContext, RowSignature, RexNode) for projections or the aggregators that don't require numeric inputs.
      Parameters:
      plannerContext - SQL planner context
      rowSignature - signature of the rows to be extracted from
      rexNode - expression meant to be applied on top of the rows
      Returns:
      DruidExpression referring to fields in rowOrder, or null if not possible to translate