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);
}
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());
}
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());
}
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());
}
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"));
}
Aggregations