use of io.dingodb.calcite.rel.DingoTableScan in project dingo by dingodb.
the class DingoFilterScanRule method onMatch.
@Override
public void onMatch(@Nonnull RelOptRuleCall call) {
final Filter filter = call.rel(0);
final DingoTableScan scan = call.rel(1);
call.transformTo(new DingoTableScan(scan.getCluster(), scan.getTraitSet(), scan.getHints(), scan.getTable(), filter.getCondition(), scan.getSelection()));
}
use of io.dingodb.calcite.rel.DingoTableScan in project dingo by dingodb.
the class DingoGetByKeysRule method onMatch.
@Override
public void onMatch(@Nonnull RelOptRuleCall call) {
final DingoTableScan rel = call.rel(0);
RexNode rexNode = RexUtil.toDnf(rel.getCluster().getRexBuilder(), rel.getFilter());
TableDefinition td = dingo(rel.getTable()).getTableDefinition();
KeyTuplesRexVisitor visitor = new KeyTuplesRexVisitor(td);
Set<Object[]> keyTuples = rexNode.accept(visitor);
if (checkKeyTuples(keyTuples)) {
call.transformTo(new DingoGetByKeys(rel.getCluster(), rel.getTraitSet().replace(DingoConventions.DISTRIBUTED), rel.getTable(), keyTuples, rel.getSelection()));
}
}
use of io.dingodb.calcite.rel.DingoTableScan in project dingo by dingodb.
the class DingoProjectScanRule method onMatch.
@Override
public void onMatch(@Nonnull RelOptRuleCall call) {
final LogicalProject project = call.rel(0);
final DingoTableScan scan = call.rel(1);
List<Integer> selectedColumns = getSelectedColumns(project.getProjects());
DingoTableScan newScan = new DingoTableScan(scan.getCluster(), scan.getTraitSet(), scan.getHints(), scan.getTable(), scan.getFilter(), TupleMapping.of(selectedColumns));
Mapping mapping = Mappings.target(selectedColumns, scan.getRowType().getFieldCount());
final List<RexNode> newProjectRexNodes = RexUtil.apply(mapping, project.getProjects());
if (RexUtil.isIdentity(newProjectRexNodes, newScan.getRowType())) {
call.transformTo(newScan);
} else {
call.transformTo(call.builder().push(newScan).project(newProjectRexNodes).build());
}
}
use of io.dingodb.calcite.rel.DingoTableScan in project dingo by dingodb.
the class DingoPartScanRule method onMatch.
@Override
public void onMatch(@Nonnull RelOptRuleCall call) {
DingoTableScan rel = call.rel(0);
call.transformTo(new DingoPartScan(rel.getCluster(), rel.getTraitSet().replace(DingoConventions.DISTRIBUTED), rel.getTable(), rel.getFilter(), rel.getSelection()));
}
Aggregations