private boolean containsAvg(LogicalAggregate agg) { for (AggregateCall call : agg.getAggCallList()) { SqlAggFunction func = call.getAggregation(); if (func instanceof SqlAvgAggFunction) return true; } return false; }
relBuilder.push(aggr.copy(aggr.getTraitSet(), input, false, groupSet, asList(groupSet), aggr.getAggCallList()));
for (AggregateCall aggrCall : aggr.getAggCallList()) { final ImmutableList.Builder<Integer> newArgs = ImmutableList.builder(); for (int key : aggrCall.getArgList()) {
@Override public RelNode convert(RelNode rel) { LogicalAggregate agg = (LogicalAggregate) rel; // AVG() will be transformed into SUM()/COUNT() by AggregateReduceFunctionsRule. // Here only let the transformed plan pass. if (containsAvg(agg)) { return null; } RelTraitSet traitSet = agg.getTraitSet().replace(OLAPRel.CONVENTION); try { return new OLAPAggregateRel(agg.getCluster(), traitSet, convert(agg.getInput(), OLAPRel.CONVENTION), agg.indicator, agg.getGroupSet(), agg.getGroupSets(), agg.getAggCallList()); } catch (InvalidRelException e) { throw new IllegalStateException("Can't create OLAPAggregateRel!", e); } }
|| (singleAggregate.getAggCallList().size() != 1) || !(singleAggregate.getAggCallList().get(0).getAggregation() instanceof SqlSingleValueAggFunction)) { return;
List<AggregateCall> oldAggCalls = rel.getAggCallList();
List<AggregateCall> aggCalls = aggregate.getAggCallList(); Set<Integer> isCount = Sets.newHashSet();
|| (aggregate.getAggCallList().size() != 1) || !(aggregate.getAggCallList().get(0).getAggregation() instanceof SqlSingleValueAggFunction)) { return;
final List<AggregateCall> aggCalls = aggregate.getAggCallList(); final Set<Integer> isCountStar = Sets.newHashSet();
private ArrayList<String> getAggFieldNames(LogicalAggregate aggregate) { return aggregate.getAggCallList().stream().collect(ArrayList::new, (names, aggCall) -> names.add(aggCall.getName()), (n1, n2) -> n1.addAll(n2)); }
private boolean containsAvg(LogicalAggregate agg) { for (AggregateCall call : agg.getAggCallList()) { SqlAggFunction func = call.getAggregation(); if (func instanceof SqlAvgAggFunction) return true; } return false; }
private ArrayList<String> getAggFieldNames(LogicalAggregate aggregate) { return aggregate.getAggCallList().stream().collect(ArrayList::new, (names, aggCall) -> names.add(aggCall.getName()), (n1, n2) -> n1.addAll(n2)); }
void validateAggregateFunctions(final LogicalAggregate aggregate) { if (aggregate.getAggCallList().size() != 1) { String errMsg = "Windowing is supported ONLY with one aggregate function but the number of given functions are " + aggregate.getAggCallList().size(); log.error(errMsg); throw new SamzaException(errMsg); } if (aggregate.getAggCallList().get(0).getAggregation().getKind() != SqlKind.COUNT) { String errMsg = "Windowing is supported ONLY with COUNT aggregate function"; log.error(errMsg); throw new SamzaException(errMsg); } } }
public RelNode visit(LogicalAggregate aggregate) { List<AggregateCall> aggCallList = aggregate.getAggCallList(); for (int i = 0; i < aggCallList.size(); i++) { if (aggCallList.get(i).isDistinct()) { foundDistinct = true; return aggregate; } } return visitChildren(aggregate); }
@Override public RelNode visit(LogicalAggregate aggregate) { for(AggregateCall aggregateCall : aggregate.getAggCallList()) { if(aggregateCall.getAggregation() instanceof SqlSingleValueAggFunction) { // see DRILL-1937 unsupportedOperatorCollector.setException(SqlUnsupportedException.ExceptionType.FUNCTION, "Dremio doesn't currently support non-scalar sub-queries used in an expression"); throw new UnsupportedOperationException(); } } return visitChild(aggregate, 0, aggregate.getInput()); }
public RelNode convert(RelNode rel) { final LogicalAggregate agg = (LogicalAggregate) rel; final RelTraitSet traitSet = agg.getTraitSet().replace(BindableConvention.INSTANCE); try { return new BindableAggregate(rel.getCluster(), traitSet, convert(agg.getInput(), traitSet), agg.indicator, agg.getGroupSet(), agg.getGroupSets(), agg.getAggCallList()); } catch (InvalidRelException e) { RelOptPlanner.LOGGER.debug(e.toString()); return null; } } }
public RelNode convert(RelNode rel) { final LogicalAggregate agg = (LogicalAggregate) rel; final RelTraitSet traitSet = agg.getTraitSet().replace(BindableConvention.INSTANCE); try { return new BindableAggregate(rel.getCluster(), traitSet, convert(agg.getInput(), traitSet), agg.indicator, agg.getGroupSet(), agg.getGroupSets(), agg.getAggCallList()); } catch (InvalidRelException e) { RelOptPlanner.LOGGER.debug(e.toString()); return null; } } }
@Override public RelNode visit(LogicalAggregate aggregate) { final RelNode input = aggregate.getInput().accept(this); return new LogicalAggregate( cluster, copyOf(aggregate.getTraitSet()), input, aggregate.indicator, aggregate.getGroupSet(), aggregate.getGroupSets(), copyOf(aggregate.getAggCallList()) ); }
@Override public void onMatch(RelOptRuleCall call) { final LogicalAggregate aggregate = (LogicalAggregate) call.rel(0); final RelNode input = call.rel(1); if (aggregate.containsDistinctCall()) { // currently, don't use this rule if any of the aggregates contains DISTINCT return; } final RelTraitSet traits = aggregate.getTraitSet().plus(Rel.LOGICAL); final RelNode convertedInput = convert(input, input.getTraitSet().plus(Rel.LOGICAL).simplify()); call.transformTo(new AggregateRel(aggregate.getCluster(), traits, convertedInput, aggregate.indicator, aggregate.getGroupSet(), aggregate.getGroupSets(), aggregate.getAggCallList())); } }
@Override public void onMatch(RelOptRuleCall call) { final LogicalAggregate aggregate = call.rel(0); final RelNode input = call.rel(1); if (aggregate.containsDistinctCall()) { // currently, don't use this rule if any of the aggregates contains DISTINCT return; } final RelTraitSet traits = aggregate.getTraitSet().plus(DrillRel.DRILL_LOGICAL); final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify()); call.transformTo(new DrillAggregateRel(aggregate.getCluster(), traits, convertedInput, aggregate.indicator, aggregate.getGroupSet(), aggregate.getGroupSets(), aggregate.getAggCallList())); } }