int index = 0; Iterator<Integer> groupSetIter = aggr.getGroupSet().iterator(); Iterator<RelDataTypeField> typeIterator = aggr.getRowType().getFieldList().iterator(); Iterator<Integer> groupKeyIter = groupSet.iterator(); int groupKey = groupKeyIter.next();
public void onMatch(RelOptRuleCall call) { final LogicalCorrelate correlate = call.rel(0); final RelNode left = call.rel(1); final LogicalProject aggOutputProject; final LogicalAggregate aggregate; if (flavor) { aggOutputProject = call.rel(2); aggregate = call.rel(3); } else { aggregate = call.rel(2); // Create identity projection final List<Pair<RexNode, String>> projects = Lists.newArrayList(); final List<RelDataTypeField> fields = aggregate.getRowType().getFieldList(); for (int i = 0; i < fields.size(); i++) { projects.add(RexInputRef.of2(projects.size(), fields)); } aggOutputProject = (LogicalProject) RelOptUtil.createProject( aggregate, projects, false); } onMatch2(call, correlate, left, aggOutputProject, aggregate); }
int index = 0; Iterator<Integer> groupSetIter = aggr.getGroupSet().iterator(); Iterator<RelDataTypeField> typeIterator = aggr.getRowType().getFieldList().iterator(); Iterator<Integer> groupKeyIter = groupSet.iterator(); int groupKey = groupKeyIter.next();
public void onMatch(RelOptRuleCall call) { final LogicalCorrelate correlate = call.rel(0); final RelNode left = call.rel(1); final LogicalProject aggOutputProject; final LogicalAggregate aggregate; if (flavor) { aggOutputProject = call.rel(2); aggregate = call.rel(3); } else { aggregate = call.rel(2); // Create identity projection final List<Pair<RexNode, String>> projects = new ArrayList<>(); final List<RelDataTypeField> fields = aggregate.getRowType().getFieldList(); for (int i = 0; i < fields.size(); i++) { projects.add(RexInputRef.of2(projects.size(), fields)); } final RelBuilder relBuilder = call.builder(); relBuilder.push(aggregate) .projectNamed(Pair.left(projects), Pair.right(projects), true); aggOutputProject = (LogicalProject) relBuilder.build(); } onMatch2(call, correlate, left, aggOutputProject, aggregate); }
public void onMatch(RelOptRuleCall call) { final LogicalCorrelate correlate = call.rel(0); final RelNode left = call.rel(1); final LogicalProject aggOutputProject; final LogicalAggregate aggregate; if (flavor) { aggOutputProject = call.rel(2); aggregate = call.rel(3); } else { aggregate = call.rel(2); // Create identity projection final List<Pair<RexNode, String>> projects = new ArrayList<>(); final List<RelDataTypeField> fields = aggregate.getRowType().getFieldList(); for (int i = 0; i < fields.size(); i++) { projects.add(RexInputRef.of2(projects.size(), fields)); } final RelBuilder relBuilder = call.builder(); relBuilder.push(aggregate) .projectNamed(Pair.left(projects), Pair.right(projects), true); aggOutputProject = (LogicalProject) relBuilder.build(); } onMatch2(call, correlate, left, aggOutputProject, aggregate); }
for(int field = 0; field < agg.getRowType().getFieldCount(); field++) { if(!hllApplications.contains(field)) { nodes.add(builder.field(field));
public void onMatch(RelOptRuleCall call) { final LogicalCorrelate correlate = call.rel(0); final RelNode left = call.rel(1); final LogicalProject aggOutputProject; final LogicalAggregate aggregate; if (flavor) { aggOutputProject = call.rel(2); aggregate = call.rel(3); } else { aggregate = call.rel(2); // Create identity projection final List<Pair<RexNode, String>> projects = Lists.newArrayList(); final List<RelDataTypeField> fields = aggregate.getRowType().getFieldList(); for (int i = 0; i < fields.size(); i++) { projects.add(RexInputRef.of2(projects.size(), fields)); } final RelBuilder relBuilder = call.builder(); relBuilder.push(aggregate) .projectNamed(Pair.left(projects), Pair.right(projects), true); aggOutputProject = (LogicalProject) relBuilder.build(); } onMatch2(call, correlate, left, aggOutputProject, aggregate); }
@Override public RelNode visit(LogicalAggregate aggregate) { RelNode input = aggregate.getInput().accept(this); final RelBuilder relBuilder = newCalciteRelBuilderWithoutContext(aggregate.getCluster()); relBuilder.push(input); RelDataType incomingRowType = input.getRowType(); RelDataTypeField modField = incomingRowType.getField(UPDATE_COLUMN, false, false); ImmutableBitSet newGroupSet = aggregate.getGroupSet().rebuild().set(modField.getIndex()).build(); GroupKey groupKey = relBuilder.groupKey(newGroupSet, aggregate.indicator, null); relBuilder.aggregate(groupKey, aggregate.getAggCallList()); Iterable<RexInputRef> projects = FluentIterable.from(aggregate.getRowType().getFieldNames()) .transform(new Function<String, RexInputRef>() { @Override public RexInputRef apply(String fieldName) { return relBuilder.field(fieldName); } }) .append(relBuilder.field(UPDATE_COLUMN)); relBuilder.project(projects); return relBuilder.build(); }