use of io.dingodb.exec.operator.ReduceOperator in project dingo by dingodb.
the class DingoJobVisitor method visit.
@Override
public Collection<Output> visit(@Nonnull DingoReduce rel) {
Collection<Output> inputs = dingo(rel.getInput()).accept(this);
int size = inputs.size();
if (size <= 1) {
return inputs;
}
Operator operator;
operator = new ReduceOperator(inputs.size(), rel.getKeyMapping(), rel.getAggList());
operator.setId(idGenerator.get());
Output one = inputs.iterator().next();
Task task = one.getTask();
task.putOperator(operator);
int i = 0;
for (Output input : inputs) {
assert input.getTask().equals(task) : "Operator linked must be in the same task.";
input.setLink(operator.getInput(i));
++i;
}
return operator.getOutputs();
}
Aggregations