Search in sources :

Example 1 with CoalesceOperator

use of io.dingodb.exec.operator.CoalesceOperator 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();
}
Also used : SumUpOperator(io.dingodb.exec.operator.SumUpOperator) AggregateOperator(io.dingodb.exec.operator.AggregateOperator) SortOperator(io.dingodb.exec.operator.SortOperator) RootOperator(io.dingodb.exec.operator.RootOperator) PartScanOperator(io.dingodb.exec.operator.PartScanOperator) SendOperator(io.dingodb.exec.operator.SendOperator) ReceiveOperator(io.dingodb.exec.operator.ReceiveOperator) ProjectOperator(io.dingodb.exec.operator.ProjectOperator) ValuesOperator(io.dingodb.exec.operator.ValuesOperator) PartUpdateOperator(io.dingodb.exec.operator.PartUpdateOperator) ReduceOperator(io.dingodb.exec.operator.ReduceOperator) Operator(io.dingodb.exec.base.Operator) GetByKeysOperator(io.dingodb.exec.operator.GetByKeysOperator) PartitionOperator(io.dingodb.exec.operator.PartitionOperator) PartDeleteOperator(io.dingodb.exec.operator.PartDeleteOperator) PartInsertOperator(io.dingodb.exec.operator.PartInsertOperator) CoalesceOperator(io.dingodb.exec.operator.CoalesceOperator) Task(io.dingodb.exec.base.Task) CoalesceOperator(io.dingodb.exec.operator.CoalesceOperator) Output(io.dingodb.exec.base.Output) SumUpOperator(io.dingodb.exec.operator.SumUpOperator) OutputHint(io.dingodb.exec.base.OutputHint)

Aggregations

Operator (io.dingodb.exec.base.Operator)1 Output (io.dingodb.exec.base.Output)1 OutputHint (io.dingodb.exec.base.OutputHint)1 Task (io.dingodb.exec.base.Task)1 AggregateOperator (io.dingodb.exec.operator.AggregateOperator)1 CoalesceOperator (io.dingodb.exec.operator.CoalesceOperator)1 GetByKeysOperator (io.dingodb.exec.operator.GetByKeysOperator)1 PartDeleteOperator (io.dingodb.exec.operator.PartDeleteOperator)1 PartInsertOperator (io.dingodb.exec.operator.PartInsertOperator)1 PartScanOperator (io.dingodb.exec.operator.PartScanOperator)1 PartUpdateOperator (io.dingodb.exec.operator.PartUpdateOperator)1 PartitionOperator (io.dingodb.exec.operator.PartitionOperator)1 ProjectOperator (io.dingodb.exec.operator.ProjectOperator)1 ReceiveOperator (io.dingodb.exec.operator.ReceiveOperator)1 ReduceOperator (io.dingodb.exec.operator.ReduceOperator)1 RootOperator (io.dingodb.exec.operator.RootOperator)1 SendOperator (io.dingodb.exec.operator.SendOperator)1 SortOperator (io.dingodb.exec.operator.SortOperator)1 SumUpOperator (io.dingodb.exec.operator.SumUpOperator)1 ValuesOperator (io.dingodb.exec.operator.ValuesOperator)1