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;
}
Aggregations