Search in sources :

Example 6 with IndexCountPlanNode

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

the class TestIndexSelection method checkIndexSkipNullPredicateIsNull.

private void checkIndexSkipNullPredicateIsNull(AbstractPlanNode pn, boolean hasSkipNullPredicate) {
    assertEquals(1, pn.getChildCount());
    pn = pn.getChild(0);
    if (pn instanceof IndexCountPlanNode) {
        assertEquals(hasSkipNullPredicate, ((IndexCountPlanNode) pn).hasSkipNullPredicate());
    } else {
        // index scan
        AbstractExpression skipNull = ((IndexScanPlanNode) pn).getSkipNullPredicate();
        assertEquals(hasSkipNullPredicate, skipNull != null);
    }
}
Also used : IndexCountPlanNode(org.voltdb.plannodes.IndexCountPlanNode) AbstractExpression(org.voltdb.expressions.AbstractExpression) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode)

Example 7 with IndexCountPlanNode

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

the class TestIndexSelection method checkCountUsesIndex.

private void checkCountUsesIndex(AbstractPlanNode pn, String targetIndexName) {
    assertEquals(1, pn.getChildCount());
    pn = pn.getChild(0);
    assertEquals(PlanNodeType.INDEXCOUNT, pn.getPlanNodeType());
    IndexCountPlanNode icpn = (IndexCountPlanNode) pn;
    assertTrue(icpn.hasTargetIndexName(targetIndexName));
}
Also used : IndexCountPlanNode(org.voltdb.plannodes.IndexCountPlanNode)

Example 8 with IndexCountPlanNode

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

the class CompiledPlan method boundParamIndexes.

/// Extract a sorted de-duped vector of all the bound parameter indexes in a plan. Or null if none.
public int[] boundParamIndexes() {
    if (parameters.length == 0) {
        return null;
    }
    BitSet ints = new BitSet();
    ArrayList<AbstractPlanNode> ixscans = rootPlanGraph.findAllNodesOfType(PlanNodeType.INDEXSCAN);
    if (subPlanGraph != null) {
        ixscans.addAll(subPlanGraph.findAllNodesOfType(PlanNodeType.INDEXSCAN));
    }
    for (AbstractPlanNode apn : ixscans) {
        assert (apn instanceof IndexScanPlanNode);
        IndexScanPlanNode ixs = (IndexScanPlanNode) apn;
        setParamIndexes(ints, ixs.getBindings());
    }
    ArrayList<AbstractPlanNode> ixcounts = rootPlanGraph.findAllNodesOfType(PlanNodeType.INDEXCOUNT);
    if (subPlanGraph != null) {
        ixcounts.addAll(subPlanGraph.findAllNodesOfType(PlanNodeType.INDEXCOUNT));
    }
    for (AbstractPlanNode apn : ixcounts) {
        assert (apn instanceof IndexCountPlanNode);
        IndexCountPlanNode ixc = (IndexCountPlanNode) apn;
        setParamIndexes(ints, ixc.getBindings());
    }
    return bitSetToIntVector(ints);
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) IndexCountPlanNode(org.voltdb.plannodes.IndexCountPlanNode) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode) BitSet(java.util.BitSet)

Aggregations

IndexCountPlanNode (org.voltdb.plannodes.IndexCountPlanNode)8 AbstractPlanNode (org.voltdb.plannodes.AbstractPlanNode)6 AggregatePlanNode (org.voltdb.plannodes.AggregatePlanNode)3 IndexScanPlanNode (org.voltdb.plannodes.IndexScanPlanNode)3 AbstractExpression (org.voltdb.expressions.AbstractExpression)2 ArrayList (java.util.ArrayList)1 BitSet (java.util.BitSet)1 Index (org.voltdb.catalog.Index)1 SeqScanPlanNode (org.voltdb.plannodes.SeqScanPlanNode)1 TableCountPlanNode (org.voltdb.plannodes.TableCountPlanNode)1