Search in sources :

Example 6 with PlanCost

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

the class QueryPlanTest method testModelPlanNode.

public void testModelPlanNode() {
    PlanNode bean = new PlanNode();
    bean.setDepth(5);
    assertEquals(bean.getDepth(), 5);
    bean.setMethod("method");
    assertEquals(bean.getMethod(), "method");
    bean.setPosition("position");
    assertEquals(bean.getPosition(), "position");
    bean.setCost(new PlanCost());
    assertEquals(bean.getCost().getClass(), PlanCost.class);
    bean.setTable(new PlanTable());
    assertEquals(bean.getTable().getClass(), PlanTable.class);
    bean.setIndex(new PlanTerm());
    assertEquals(bean.getIndex().getClass(), PlanTerm.class);
    bean.setEdge(new PlanTerm());
    assertEquals(bean.getEdge().getClass(), PlanTerm.class);
    bean.setSargs(new PlanTerm());
    assertEquals(bean.getSargs().getClass(), PlanTerm.class);
    bean.setFilter(new PlanTerm());
    assertEquals(bean.getFilter().getClass(), PlanTerm.class);
    bean.setSort("sort");
    assertEquals(bean.getSort(), "sort");
    bean.setOrder("order");
    assertEquals(bean.getOrder(), "order");
    assertEquals(bean.toString() == null, false);
    bean.getChildren();
    bean.newChild();
    bean.addChild(new PlanNode());
    assertNotNull(bean.toString());
    assertNotNull(bean.getDebugString());
}
Also used : PlanNode(com.cubrid.common.core.queryplan.model.PlanNode) PlanCost(com.cubrid.common.core.queryplan.model.PlanCost) PlanTable(com.cubrid.common.core.queryplan.model.PlanTable) PlanTerm(com.cubrid.common.core.queryplan.model.PlanTerm)

Example 7 with PlanCost

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

the class QueryPlanTest method testModelPlanCost.

public void testModelPlanCost() {
    PlanCost bean = new PlanCost();
    bean.setFixedTotal(10);
    assertEquals(bean.getFixedTotal(), 10.0f);
    bean.setFixedCpu(8);
    assertEquals(bean.getFixedCpu(), 8.0f);
    bean.setFixedDisk(9);
    assertEquals(bean.getFixedDisk(), 9.0f);
    bean.setVarTotal(8);
    assertEquals(bean.getVarTotal(), 8.0f);
    bean.setVarCpu(6);
    assertEquals(bean.getVarCpu(), 6.0f);
    bean.setVarDisk(7);
    assertEquals(bean.getVarDisk(), 7.0f);
    bean.setCard(4);
    assertEquals(bean.getCard(), 4);
    assertEquals(bean.toString() == null, false);
}
Also used : PlanCost(com.cubrid.common.core.queryplan.model.PlanCost)

Example 8 with PlanCost

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

the class QueryPlanTest method testModelPlanNode.

public void testModelPlanNode() {
    PlanNode bean = new PlanNode();
    bean.setDepth(5);
    assertEquals(bean.getDepth(), 5);
    bean.setMethod("method");
    assertEquals(bean.getMethod(), "method");
    bean.setPosition("position");
    assertEquals(bean.getPosition(), "position");
    bean.setCost(new PlanCost());
    assertEquals(bean.getCost().getClass(), PlanCost.class);
    bean.setTable(new PlanTable());
    assertEquals(bean.getTable().getClass(), PlanTable.class);
    bean.setIndex(new PlanTerm());
    assertEquals(bean.getIndex().getClass(), PlanTerm.class);
    bean.setEdge(new PlanTerm());
    assertEquals(bean.getEdge().getClass(), PlanTerm.class);
    bean.setSargs(new PlanTerm());
    assertEquals(bean.getSargs().getClass(), PlanTerm.class);
    bean.setFilter(new PlanTerm());
    assertEquals(bean.getFilter().getClass(), PlanTerm.class);
    bean.setSort("sort");
    assertEquals(bean.getSort(), "sort");
    bean.setOrder("order");
    assertEquals(bean.getOrder(), "order");
    assertEquals(bean.toString() == null, false);
    bean.getChildren();
    bean.newChild();
}
Also used : PlanNode(com.cubrid.common.core.queryplan.model.PlanNode) PlanCost(com.cubrid.common.core.queryplan.model.PlanCost) PlanTable(com.cubrid.common.core.queryplan.model.PlanTable) PlanTerm(com.cubrid.common.core.queryplan.model.PlanTerm)

Example 9 with PlanCost

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

the class QueryPlanTest method testModelPlanCost.

public void testModelPlanCost() {
    PlanCost bean = new PlanCost();
    bean.setFixedTotal(10);
    assertEquals(bean.getFixedTotal(), 10.0f);
    bean.setFixedCpu(8);
    assertEquals(bean.getFixedCpu(), 8.0f);
    bean.setFixedDisk(9);
    assertEquals(bean.getFixedDisk(), 9.0f);
    bean.setVarTotal(8);
    assertEquals(bean.getVarTotal(), 8.0f);
    bean.setVarCpu(6);
    assertEquals(bean.getVarCpu(), 6.0f);
    bean.setVarDisk(7);
    assertEquals(bean.getVarDisk(), 7.0f);
    bean.setCard(4);
    assertEquals(bean.getCard(), 4);
    assertEquals(bean.toString() == null, false);
}
Also used : PlanCost(com.cubrid.common.core.queryplan.model.PlanCost)

Example 10 with PlanCost

use of com.cubrid.common.core.queryplan.model.PlanCost 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)

Aggregations

PlanCost (com.cubrid.common.core.queryplan.model.PlanCost)10 PlanNode (com.cubrid.common.core.queryplan.model.PlanNode)7 PlanTerm (com.cubrid.common.core.queryplan.model.PlanTerm)4 PlanResult (com.cubrid.common.core.queryplan.model.PlanResult)3 PlanTable (com.cubrid.common.core.queryplan.model.PlanTable)2 PlanParser (com.cubrid.common.core.queryplan.PlanParser)1 Matcher (java.util.regex.Matcher)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1 TableItem (org.eclipse.swt.widgets.TableItem)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1