use of io.dingodb.exec.operator.SumUpOperator in project dingo by dingodb.
the class DingoJobVisitor method visit.
@Override
public Collection<Output> visit(@Nonnull DingoCoalesce rel) {
Collection<Output> inputs = dingo(rel.getInput()).accept(this);
int size = inputs.size();
if (size <= 1) {
return inputs;
}
Output one = inputs.iterator().next();
boolean isToSumUp = one.isToSumUp();
Operator operator = isToSumUp ? new SumUpOperator(size) : new CoalesceOperator(size);
operator.setId(idGenerator.get());
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.";
assert input.isToSumUp() == isToSumUp : "All inputs must have the same \"toSumUp\" hint.";
input.setLink(operator.getInput(i));
++i;
}
return operator.getOutputs();
}
Aggregations