Search in sources :

Example 21 with AbstractPlanNode

use of org.voltdb.plannodes.AbstractPlanNode in project voltdb by VoltDB.

the class TestPlansCount method testTableCount.

public void testTableCount() {
    List<AbstractPlanNode> pn = compileToFragments("SELECT count(ID) from P1");
    AbstractPlanNode p = pn.get(0).getChild(0);
    assertTrue(p instanceof AggregatePlanNode);
    p = pn.get(1).getChild(0);
    assertTrue(p instanceof TableCountPlanNode);
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) AggregatePlanNode(org.voltdb.plannodes.AggregatePlanNode) TableCountPlanNode(org.voltdb.plannodes.TableCountPlanNode)

Example 22 with AbstractPlanNode

use of org.voltdb.plannodes.AbstractPlanNode in project voltdb by VoltDB.

the class TestPlansCount method testCountStar003.

// Test subquery temp table count
public void testCountStar003() {
    List<AbstractPlanNode> pn = compileToFragments("select count(*) from (SELECT count(*) from T1) Temp");
    AbstractPlanNode p = pn.get(0).getChild(0);
    assertTrue(p instanceof TableCountPlanNode);
    p = p.getChild(0);
    assertTrue(p instanceof TableCountPlanNode);
    pn = compileToFragments("select count(1) from (SELECT count(*) from T1) Temp");
    p = pn.get(0).getChild(0);
    assertTrue(p instanceof TableCountPlanNode);
    p = p.getChild(0);
    assertTrue(p instanceof TableCountPlanNode);
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) TableCountPlanNode(org.voltdb.plannodes.TableCountPlanNode)

Example 23 with AbstractPlanNode

use of org.voltdb.plannodes.AbstractPlanNode in project voltdb by VoltDB.

the class TestPlansCount method testCountStar002.

public void testCountStar002() {
    List<AbstractPlanNode> pn = compileToFragments("SELECT POINTS, count(*) from T1 Group by POINTS");
    AbstractPlanNode p = pn.get(0).getChild(0);
    assertTrue(p instanceof IndexScanPlanNode);
    assertNotNull(p.getInlinePlanNode(PlanNodeType.AGGREGATE));
    pn = compileToFragments("SELECT POINTS, count(1) from T1 Group by POINTS");
    p = pn.get(0).getChild(0);
    assertTrue(p instanceof IndexScanPlanNode);
    assertNotNull(p.getInlinePlanNode(PlanNodeType.AGGREGATE));
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode)

Example 24 with AbstractPlanNode

use of org.voltdb.plannodes.AbstractPlanNode in project voltdb by VoltDB.

the class TestPlansCount method checkIndexCounter.

/**
     * Check Whether or not the original plan is replaced with CountingIndexPlanNode.
     *
     * @param pn
     *            The generated plan
     * @param isReplaceable
     *            Whether or not the original plan is replaced with CountingIndexPlanNode
     */
private void checkIndexCounter(List<AbstractPlanNode> pn, boolean isReplaceable) {
    assertTrue(pn.size() > 0);
    for (AbstractPlanNode nd : pn) {
        System.out.println("PlanNode Explain string:\n" + nd.toExplainPlanString());
    }
    AbstractPlanNode p = pn.get(0).getChild(0);
    if (isReplaceable)
        assertTrue(p instanceof IndexCountPlanNode);
    else
        assertTrue((p instanceof IndexCountPlanNode) == false);
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) IndexCountPlanNode(org.voltdb.plannodes.IndexCountPlanNode)

Example 25 with AbstractPlanNode

use of org.voltdb.plannodes.AbstractPlanNode in project voltdb by VoltDB.

the class TestPlansCount method testCountStar000.

// DOES NOT support the cases down below right now
// This is treated as new TABLE COUNT plan for replicated table
public void testCountStar000() {
    List<AbstractPlanNode> pn = compileToFragments("SELECT count(*) from T1");
    AbstractPlanNode p = pn.get(0).getChild(0);
    assertTrue(p instanceof TableCountPlanNode);
    pn = compileToFragments("SELECT count(1) from T1");
    p = pn.get(0).getChild(0);
    assertTrue(p instanceof TableCountPlanNode);
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) TableCountPlanNode(org.voltdb.plannodes.TableCountPlanNode)

Aggregations

AbstractPlanNode (org.voltdb.plannodes.AbstractPlanNode)259 AbstractExpression (org.voltdb.expressions.AbstractExpression)55 IndexScanPlanNode (org.voltdb.plannodes.IndexScanPlanNode)48 ProjectionPlanNode (org.voltdb.plannodes.ProjectionPlanNode)48 AbstractScanPlanNode (org.voltdb.plannodes.AbstractScanPlanNode)46 SeqScanPlanNode (org.voltdb.plannodes.SeqScanPlanNode)44 AggregatePlanNode (org.voltdb.plannodes.AggregatePlanNode)37 NestLoopPlanNode (org.voltdb.plannodes.NestLoopPlanNode)37 HashAggregatePlanNode (org.voltdb.plannodes.HashAggregatePlanNode)29 OrderByPlanNode (org.voltdb.plannodes.OrderByPlanNode)29 ReceivePlanNode (org.voltdb.plannodes.ReceivePlanNode)27 SendPlanNode (org.voltdb.plannodes.SendPlanNode)27 MergeReceivePlanNode (org.voltdb.plannodes.MergeReceivePlanNode)20 AbstractReceivePlanNode (org.voltdb.plannodes.AbstractReceivePlanNode)16 NestLoopIndexPlanNode (org.voltdb.plannodes.NestLoopIndexPlanNode)16 SchemaColumn (org.voltdb.plannodes.SchemaColumn)15 NodeSchema (org.voltdb.plannodes.NodeSchema)14 UnionPlanNode (org.voltdb.plannodes.UnionPlanNode)14 LimitPlanNode (org.voltdb.plannodes.LimitPlanNode)12 PlanNodeType (org.voltdb.types.PlanNodeType)12