Search in sources :

Example 41 with PlanNode

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);
            }
        }
    }
}
Also used : PlanNode(com.actiontech.dble.plan.node.PlanNode)

Example 42 with PlanNode

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;
        }
    }
}
Also used : PlanNode(com.actiontech.dble.plan.node.PlanNode) MySQLPlanNodeVisitor(com.actiontech.dble.plan.visitor.MySQLPlanNodeVisitor)

Example 43 with PlanNode

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);
}
Also used : PlanNode(com.actiontech.dble.plan.node.PlanNode) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 44 with PlanNode

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);
}
Also used : PlanNode(com.actiontech.dble.plan.node.PlanNode)

Example 45 with PlanNode

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);
}
Also used : PlanNode(com.actiontech.dble.plan.node.PlanNode) SQLSelectStatement(com.alibaba.druid.sql.ast.statement.SQLSelectStatement) MySQLPlanNodeVisitor(com.actiontech.dble.plan.visitor.MySQLPlanNodeVisitor) HandlerBuilder(com.actiontech.dble.backend.mysql.nio.handler.builder.HandlerBuilder) BaseHandlerBuilder(com.actiontech.dble.backend.mysql.nio.handler.builder.BaseHandlerBuilder)

Aggregations

PlanNode (com.actiontech.dble.plan.node.PlanNode)50 JoinNode (com.actiontech.dble.plan.node.JoinNode)16 Item (com.actiontech.dble.plan.common.item.Item)14 ArrayList (java.util.ArrayList)10 QueryNode (com.actiontech.dble.plan.node.QueryNode)8 ItemFuncEqual (com.actiontech.dble.plan.common.item.function.operator.cmpfunc.ItemFuncEqual)6 MySQLOutPutException (com.actiontech.dble.plan.common.exception.MySQLOutPutException)5 MySQLPlanNodeVisitor (com.actiontech.dble.plan.visitor.MySQLPlanNodeVisitor)5 ItemSubQuery (com.actiontech.dble.plan.common.item.subquery.ItemSubQuery)4 SQLSelectStatement (com.alibaba.druid.sql.ast.statement.SQLSelectStatement)4 DMLResponseHandler (com.actiontech.dble.backend.mysql.nio.handler.query.DMLResponseHandler)3 NamedField (com.actiontech.dble.plan.NamedField)3 ErrorPacket (com.actiontech.dble.net.mysql.ErrorPacket)2 Order (com.actiontech.dble.plan.Order)2 TableNode (com.actiontech.dble.plan.node.TableNode)2 HashSet (java.util.HashSet)2 BaseHandlerBuilder (com.actiontech.dble.backend.mysql.nio.handler.builder.BaseHandlerBuilder)1 HandlerBuilder (com.actiontech.dble.backend.mysql.nio.handler.builder.HandlerBuilder)1 TempTableHandler (com.actiontech.dble.backend.mysql.nio.handler.query.impl.TempTableHandler)1 CallBackHandler (com.actiontech.dble.backend.mysql.nio.handler.util.CallBackHandler)1