final List<String> aggregateStageFieldNames = new ArrayList<>(); Pair<List<DimensionSpec>, List<VirtualColumn>> projectGroupSet = computeProjectGroupSet( project, groupSet, aggInputRowType, this);
.computeProjectGroupSet(project, aggregate.getGroupSet(), query.table.getRowType(), query) == null) { return;
public void onMatch(RelOptRuleCall call) { final Aggregate aggregate = call.rel(0); final DruidQuery query = call.rel(1); final RelNode topDruidNode = query.getTopNode(); final Project project = topDruidNode instanceof Project ? (Project) topDruidNode : null; if (!DruidQuery.isValidSignature(query.signature() + 'a')) { return; } if (aggregate.indicator || aggregate.getGroupSets().size() != 1) { return; } if (DruidQuery .computeProjectGroupSet(project, aggregate.getGroupSet(), query.table.getRowType(), query) == null) { return; } final List<String> aggNames = Util .skip(aggregate.getRowType().getFieldNames(), aggregate.getGroupSet().cardinality()); if (DruidQuery.computeDruidJsonAgg(aggregate.getAggCallList(), aggNames, project, query) == null) { return; } final RelNode newAggregate = aggregate .copy(aggregate.getTraitSet(), ImmutableList.of(query.getTopNode())); call.transformTo(DruidQuery.extendQuery(query, newAggregate)); } }