Search in sources :

Example 11 with PlanResult

use of com.cubrid.common.core.queryplan.model.PlanResult in project cubrid-manager by CUBRID.

the class QueryPlanTest method testModelPlanRoot.

public void testModelPlanRoot() {
    PlanResult bean = new PlanResult();
    bean.setSql("sql");
    assertEquals(bean.getSql(), "sql");
    bean.setRaw("raw");
    assertEquals(bean.getRaw(), "raw");
    bean.setPlanNode(new PlanNode());
    assertEquals(bean.getPlanNode().getClass(), PlanNode.class);
    bean.getPlainSql();
    assertEquals(bean.toString() == null, false);
    bean.setSql(null);
    bean.getPlainSql();
}
Also used : PlanResult(com.cubrid.common.core.queryplan.model.PlanResult) PlanNode(com.cubrid.common.core.queryplan.model.PlanNode)

Example 12 with PlanResult

use of com.cubrid.common.core.queryplan.model.PlanResult in project cubrid-manager by CUBRID.

the class PlanParserTest method testExam01.

/**
	 * simple plan
	 * 
	 * @throws Exception
	 */
public void testExam01() throws Exception {
    String planString = loadPlanExmaple("plan01.txt");
    PlanParser parser = new PlanParser();
    boolean bool = parser.doParse(planString);
    assertTrue(bool);
    parser.getPlanTree(1);
    PlanResult planRoot = parser.getPlanTree(0);
    assertNotNull(planRoot);
    PlanNode planNode = planRoot.getPlanNode();
    assertEquals(planNode.getMethod(), "idx-join (inner join)");
    assertEquals(planNode.getDepth(), 1);
    PlanCost planCost = planNode.getCost();
    assertNotNull(planCost);
    assertEquals(planCost.getCard(), 40);
    assertEquals(String.valueOf(planCost.getFixedCpu()), "0.0");
    assertEquals(String.valueOf(planCost.getFixedDisk()), "2.0");
    assertEquals(String.valueOf(planCost.getFixedTotal()), "2.0");
    assertEquals(String.valueOf(planCost.getVarCpu()), "100.3");
    assertEquals(String.valueOf(planCost.getVarDisk()), "275.0");
    assertEquals(String.valueOf(planCost.getVarTotal()), "375.0");
    assertNull(planNode.getTable());
    assertNull(planNode.getIndex());
    assertNull(planNode.getEdge());
    assertNull(planNode.getFilter());
    assertNull(planNode.getSort());
    assertNull(planNode.getOrder());
    PlanTerm sargs = planNode.getSargs();
    assertNotNull(sargs);
    assertNotNull(planNode.getChildren());
    assertEquals(planNode.getChildren().size(), 2);
    PlanParser parser2 = new PlanParser();
    parser2.getPlanTree(0);
    parser2.countPlanTree();
    parser2.doParse(null);
    parser2.doParse("aaa");
}
Also used : PlanResult(com.cubrid.common.core.queryplan.model.PlanResult) PlanNode(com.cubrid.common.core.queryplan.model.PlanNode) PlanCost(com.cubrid.common.core.queryplan.model.PlanCost) PlanParser(com.cubrid.common.core.queryplan.PlanParser) PlanTerm(com.cubrid.common.core.queryplan.model.PlanTerm)

Example 13 with PlanResult

use of com.cubrid.common.core.queryplan.model.PlanResult in project cubrid-manager by CUBRID.

the class PlanParserTest method testExam03.

/**
	 * Partitioned table
	 * 
	 * @throws Exception
	 */
public void testExam03() throws Exception {
    String planString = loadPlanExmaple("plan03.txt");
    PlanParser parser = new PlanParser();
    boolean bool = parser.doParse(planString);
    assertTrue(bool);
    int subPlanCount = parser.countPlanTree();
    assertEquals(1, subPlanCount);
    for (int i = 0; i < subPlanCount; i++) {
        PlanResult planRoot = parser.getPlanTree(i);
        assertNotNull(planRoot);
    }
}
Also used : PlanResult(com.cubrid.common.core.queryplan.model.PlanResult) PlanParser(com.cubrid.common.core.queryplan.PlanParser)

Aggregations

PlanResult (com.cubrid.common.core.queryplan.model.PlanResult)13 PlanNode (com.cubrid.common.core.queryplan.model.PlanNode)8 PlanParser (com.cubrid.common.core.queryplan.PlanParser)3 PlanCost (com.cubrid.common.core.queryplan.model.PlanCost)3 StructQueryPlan (com.cubrid.common.core.queryplan.StructQueryPlan)1 PlanTerm (com.cubrid.common.core.queryplan.model.PlanTerm)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 TableItem (org.eclipse.swt.widgets.TableItem)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1