use of io.mycat.calcite.table.MycatLogicTable in project Mycat2 by MyCATApache.
the class HBTQueryConvertor method fromTable.
private RelNode fromTable(FromTableSchema input) {
List<String> collect = new ArrayList<>(input.getNames());
RelNode build = relBuilder.scan(collect).as(collect.get(collect.size() - 1)).build();
MycatLogicTable mycatLogicTable = build.getTable().unwrap(MycatLogicTable.class);
// 消除逻辑表,变成物理表
if (mycatLogicTable != null) {
relBuilder.clear();
Stream<Map<String, Partition>> dataNodes = mycatLogicTable.createDistribution().getDataNodes();
return toPhyTable(mycatLogicTable, dataNodes.flatMap(i -> i.values().stream()).collect(Collectors.toList()));
}
return build;
}
use of io.mycat.calcite.table.MycatLogicTable in project Mycat2 by MyCATApache.
the class VisualTablePlanImpl method execute.
@Override
public Observable<VectorSchemaRoot> execute(RootContext rootContext) {
RelOptTable table = relNode.getRelNode().getTable();
MycatLogicTable logicTable = table.unwrap(MycatLogicTable.class);
TableHandler tableHandler = logicTable.getTable();
VisualTableHandler visualTableHandler = (VisualTableHandler) tableHandler;
MetadataManager metadataManager = MetaClusterCurrent.wrapper(MetadataManager.class);
MycatRelDataType mycatRelDataTypeByCalcite = relNode.getMycatRelDataTypeByCalcite();
Schema schema = toArrowSchema(mycatRelDataTypeByCalcite);
return ValuesPlan.create(schema, MycatRxJavaUtl.blockingIterable(visualTableHandler.scanAll())).execute(rootContext);
}
Aggregations