use of com.actiontech.dble.plan.node.PlanNode in project dble by actiontech.
the class ERJoinChooser method initInnerJoinUnits.
/**
* find the smallest join units in node
*
* @param node innerjoin
*/
private void initInnerJoinUnits(JoinNode node) {
if (isGlobalTree(node)) {
this.globals.add(node);
} else {
for (int index = 0; index < node.getChildren().size(); index++) {
PlanNode child = node.getChildren().get(index);
if (isUnit(child)) {
child = JoinERProcessor.optimize(child);
node.getChildren().set(index, child);
this.joinUnits.add(child);
} else {
initInnerJoinUnits((JoinNode) child);
}
}
}
}
use of com.actiontech.dble.plan.node.PlanNode in project dble by actiontech.
the class ItemSubQuery method init.
private void init() {
MySQLPlanNodeVisitor pv = new MySQLPlanNodeVisitor(currentDb, charsetIndex, metaManager, true);
pv.visit(this.query);
this.planNode = pv.getTableNode();
if (planNode.type() != PlanNode.PlanNodeType.NONAME) {
this.withSubQuery = true;
PlanNode test = this.planNode.copy();
try {
test.setUpFields();
} catch (Exception e) {
this.correlatedSubQuery = true;
}
}
}
use of com.actiontech.dble.plan.node.PlanNode in project dble by actiontech.
the class TestMySQLPlanNodeVisitor method testNoraml.
@Ignore
@Test
public void testNoraml() {
PlanNode tableNode = getPlanNode("select * from tvistor");
System.out.println(tableNode);
Assert.assertEquals(true, tableNode != null);
}
use of com.actiontech.dble.plan.node.PlanNode in project dble by actiontech.
the class ItemVariables method fixRefer.
@Override
public final void fixRefer(ReferContext context) {
PlanNode node = context.getPlanNode();
PlanNode tn = getReferTables().iterator().next();
node.addSelToReferedMap(tn, this);
}
use of com.actiontech.dble.plan.node.PlanNode in project dble by actiontech.
the class ExplainHandler method buildNodes.
private static BaseHandlerBuilder buildNodes(RouteResultset rrs, ServerConnection c) {
SQLSelectStatement ast = (SQLSelectStatement) rrs.getSqlStatement();
MySQLPlanNodeVisitor visitor = new MySQLPlanNodeVisitor(c.getSchema(), c.getCharset().getResultsIndex(), DbleServer.getInstance().getTmManager(), false);
visitor.visit(ast);
PlanNode node = visitor.getTableNode();
node.setSql(rrs.getStatement());
node.setUpFields();
PlanUtil.checkTablesPrivilege(c, node, ast);
node = MyOptimizer.optimize(node);
if (!PlanUtil.containsSubQuery(node) && !visitor.isContainSchema()) {
node.setAst(ast);
}
HandlerBuilder builder = new HandlerBuilder(node, c.getSession2());
return builder.getBuilder(c.getSession2(), node, true);
}
Aggregations