Search in sources :

Example 1 with PartScanOperator

use of io.dingodb.exec.operator.PartScanOperator in project dingo by dingodb.

the class DingoJobVisitor method visit.

@Override
public Collection<Output> visit(@Nonnull DingoPartScan rel) {
    String tableName = getSimpleName(rel.getTable());
    TableDefinition td = Services.META.getTableDefinition(tableName);
    Map<String, Location> parts = Services.META.getPartLocations(tableName);
    List<Output> outputs = new ArrayList<>(parts.size());
    TableId tableId = new TableId(Services.META.getTableKey(tableName));
    String filterStr = null;
    if (rel.getFilter() != null) {
        filterStr = RexConverter.convert(rel.getFilter()).toString();
    }
    for (Map.Entry<String, Location> entry : parts.entrySet()) {
        final Object partId = entry.getKey();
        PartScanOperator operator = new PartScanOperator(tableId, entry.getKey(), td.getTupleSchema(), td.getKeyMapping(), filterStr, rel.getSelection());
        operator.setId(idGenerator.get());
        Task task = job.getOrCreate(entry.getValue());
        task.putOperator(operator);
        operator.getSoleOutput().setHint(OutputHint.of(tableName, partId));
        outputs.addAll(operator.getOutputs());
    }
    return outputs;
}
Also used : TableId(io.dingodb.common.table.TableId) Task(io.dingodb.exec.base.Task) ArrayList(java.util.ArrayList) PartScanOperator(io.dingodb.exec.operator.PartScanOperator) Output(io.dingodb.exec.base.Output) TableDefinition(io.dingodb.common.table.TableDefinition) Map(java.util.Map) Location(io.dingodb.meta.Location)

Aggregations

TableDefinition (io.dingodb.common.table.TableDefinition)1 TableId (io.dingodb.common.table.TableId)1 Output (io.dingodb.exec.base.Output)1 Task (io.dingodb.exec.base.Task)1 PartScanOperator (io.dingodb.exec.operator.PartScanOperator)1 Location (io.dingodb.meta.Location)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1