Search in sources :

Example 16 with IndexScanPlanNode

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

the class TestIndexCoveringPlans method testSingleColumnLessThan.

public void testSingleColumnLessThan() {
    AbstractPlanNode pn = compile("select a from t where a < ?;");
    pn = pn.getChild(0);
    if (pn != null) {
        System.out.println(pn.toJSONString());
    }
    assertTrue(pn instanceof IndexScanPlanNode);
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode)

Example 17 with IndexScanPlanNode

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

the class TestIndexCoveringPlans method testEng1023.

// The planner should choose cover2_tree, which is over columns a and b.
// It should use this index as a covering index, so it should be a
// greater-than lookup type
public void testEng1023() {
    AbstractPlanNode pn = compile("select a from t where a = ? and b < ?;");
    pn = pn.getChild(0);
    if (pn != null) {
        System.out.println(pn.toJSONString());
    }
    assertTrue(pn instanceof IndexScanPlanNode);
    IndexScanPlanNode ispn = (IndexScanPlanNode) pn;
    assertEquals("COVER2_TREE", ispn.getTargetIndexName());
    assertEquals(IndexLookupType.LT, ispn.getLookupType());
    assertEquals(2, ispn.getSearchKeyExpressions().size());
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode)

Example 18 with IndexScanPlanNode

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

the class TestIndexCoveringPlans method testCover3ColumnsOutOfOrderWithLessThan.

public void testCover3ColumnsOutOfOrderWithLessThan() {
    AbstractPlanNode pn = compile("select a from t where a = ? and b = ? and c < ?;");
    pn = pn.getChild(0);
    if (pn != null) {
        System.out.println(pn.toJSONString());
    }
    assertTrue(pn instanceof IndexScanPlanNode);
    IndexScanPlanNode ispn = (IndexScanPlanNode) pn;
    assertEquals("IDX_1_TREE", ispn.getTargetIndexName());
    assertEquals(IndexLookupType.LT, ispn.getLookupType());
    assertEquals(3, ispn.getSearchKeyExpressions().size());
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode)

Example 19 with IndexScanPlanNode

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

the class TestIndexCoveringPlans method testCover3ColumnsInOrderWithLessThanAndOrderBy.

public void testCover3ColumnsInOrderWithLessThanAndOrderBy() {
    AbstractPlanNode pn = compile("select a, b from t where a = ? and c = ? and b < ? order by b;");
    pn = pn.getChild(0);
    if (pn != null) {
        System.out.println(pn.toJSONString());
    }
    assertTrue(pn instanceof IndexScanPlanNode);
    IndexScanPlanNode ispn = (IndexScanPlanNode) pn;
    assertEquals("COVER3_TREE", ispn.getTargetIndexName());
    assertEquals(IndexLookupType.GTE, ispn.getLookupType());
    assertEquals(2, ispn.getSearchKeyExpressions().size());
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode)

Example 20 with IndexScanPlanNode

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

the class TestIndexSelection method testGeoIndex.

public void testGeoIndex() {
    AbstractPlanNode pn;
    IndexScanPlanNode indexScan;
    String jsonicIdxScan;
    pn = compile("select polys.point " + "from polypoints polys " + "where contains(polys.poly, ?);");
    pn = pn.getChild(0);
    /* enable to debug */
    System.out.println("DEBUG: " + pn.toExplainPlanString());
    assertTrue(pn instanceof IndexScanPlanNode);
    indexScan = (IndexScanPlanNode) pn;
    assertEquals(IndexLookupType.GEO_CONTAINS, indexScan.getLookupType());
    jsonicIdxScan = indexScan.toJSONString();
    /* enable to debug */
    System.out.println("DEBUG: " + jsonicIdxScan);
    assertEquals("POLYPOINTSPOLY", indexScan.getTargetIndexName());
    // Expecting one index search key expression
    // that is a parameter (31) of type GEOGRAPHY_POINT (26).
    assertEquals(1, indexScan.getSearchKeyExpressions().size());
    assertTrue(jsonicIdxScan.contains("\"SEARCHKEY_EXPRESSIONS\":[{\"TYPE\":31,\"VALUE_TYPE\":26"));
    pn = compile("select polys.poly, points.point " + "from polypoints polys, polypoints points " + "where contains(polys.poly, points.point);");
    pn = pn.getChild(0);
    pn = pn.getChild(0);
    /* enable to debug */
    System.out.println("DEBUG: " + pn.toExplainPlanString());
    assertTrue(pn instanceof NestLoopIndexPlanNode);
    indexScan = ((NestLoopIndexPlanNode) pn).getInlineIndexScan();
    assertEquals(IndexLookupType.GEO_CONTAINS, indexScan.getLookupType());
    jsonicIdxScan = indexScan.toJSONString();
    assertEquals("POLYPOINTSPOLY", indexScan.getTargetIndexName());
    // Expecting one index search key expression
    // that is a TVE (32) of type GEOGRAPHY_POINT (26).
    assertEquals(1, indexScan.getSearchKeyExpressions().size());
    assertTrue(jsonicIdxScan.contains("\"SEARCHKEY_EXPRESSIONS\":[{\"TYPE\":32,\"VALUE_TYPE\":26"));
    pn = pn.getChild(0);
    // A non-geography index scan over a unique key for the
    // outer scan of "points" gets injected strictly for determinism.
    assertTrue(pn instanceof IndexScanPlanNode);
    indexScan = (IndexScanPlanNode) pn;
    assertEquals(IndexLookupType.GTE, indexScan.getLookupType());
    pn = compile("select polys.point " + "from polypoints polys " + "where contains(polys.poly, ?);");
    pn = pn.getChild(0);
    //* enable to debug */ System.out.println("DEBUG: " + pn.toExplainPlanString());
    assertTrue(pn instanceof IndexScanPlanNode);
    indexScan = (IndexScanPlanNode) pn;
    assertEquals(IndexLookupType.GEO_CONTAINS, indexScan.getLookupType());
    jsonicIdxScan = indexScan.toJSONString();
    //* enable to debug */ System.out.println("DEBUG: " + jsonicIdxScan);
    assertEquals("POLYPOINTSPOLY", indexScan.getTargetIndexName());
    // Expecting one index search key expression
    // that is a parameter (31) of type GEOGRAPHY_POINT (26).
    assertEquals(1, indexScan.getSearchKeyExpressions().size());
    assertTrue(jsonicIdxScan.contains("\"SEARCHKEY_EXPRESSIONS\":[{\"TYPE\":31,\"VALUE_TYPE\":26"));
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode) NestLoopIndexPlanNode(org.voltdb.plannodes.NestLoopIndexPlanNode)

Aggregations

IndexScanPlanNode (org.voltdb.plannodes.IndexScanPlanNode)60 AbstractPlanNode (org.voltdb.plannodes.AbstractPlanNode)48 AbstractExpression (org.voltdb.expressions.AbstractExpression)22 NestLoopIndexPlanNode (org.voltdb.plannodes.NestLoopIndexPlanNode)15 SeqScanPlanNode (org.voltdb.plannodes.SeqScanPlanNode)14 NestLoopPlanNode (org.voltdb.plannodes.NestLoopPlanNode)11 ProjectionPlanNode (org.voltdb.plannodes.ProjectionPlanNode)8 AggregatePlanNode (org.voltdb.plannodes.AggregatePlanNode)7 OrderByPlanNode (org.voltdb.plannodes.OrderByPlanNode)6 ArrayList (java.util.ArrayList)5 Index (org.voltdb.catalog.Index)5 ReceivePlanNode (org.voltdb.plannodes.ReceivePlanNode)5 AbstractReceivePlanNode (org.voltdb.plannodes.AbstractReceivePlanNode)4 AbstractScanPlanNode (org.voltdb.plannodes.AbstractScanPlanNode)4 HashAggregatePlanNode (org.voltdb.plannodes.HashAggregatePlanNode)4 SendPlanNode (org.voltdb.plannodes.SendPlanNode)4 TupleValueExpression (org.voltdb.expressions.TupleValueExpression)3 IndexCountPlanNode (org.voltdb.plannodes.IndexCountPlanNode)3 StmtTableScan (org.voltdb.planner.parseinfo.StmtTableScan)2 AbstractJoinPlanNode (org.voltdb.plannodes.AbstractJoinPlanNode)2