use of org.voltdb.plannodes.AbstractPlanNode in project voltdb by VoltDB.
the class TestIndexSelection method testFixedPlanWithExpressionIndexAndAlias.
public void testFixedPlanWithExpressionIndexAndAlias() {
AbstractPlanNode pn;
IndexScanPlanNode ispn;
String leftIndexName;
pn = compile("select * from l aliased where b = ? and DECODE(a, null, 0, a) = 0 and id = ?;");
// System.out.println("DEBUG: " + pn.toExplainPlanString());
pn = pn.getChild(0);
assertTrue(pn instanceof IndexScanPlanNode);
ispn = (IndexScanPlanNode) pn;
assertEquals("DECODE_IDX3", ispn.getTargetIndexName());
assertEquals(3, ispn.getSearchKeyExpressions().size());
pn = compile("select * from l aliased, l where l.b = ? and DECODE(l.a, null, 0, l.a) = 0 and l.id = ? and l.lname = aliased.lname;");
//* to debug */ System.out.println("DEBUG: " + pn.toExplainPlanString());
checkDualIndexedJoin(pn, "IDX_A", "DECODE_IDX3", 3);
pn = compile("select * from l x, l where x.b = ? and DECODE(x.a, null, 0, x.a) = 0 and x.id = ? and l.lname = x.lname;");
//* to debug */ System.out.println("DEBUG: " + pn.toExplainPlanString());
// Skip the Send, Projection, and NestLoop plan nodes.
pn = pn.getChild(0).getChild(0).getChild(0);
assertTrue(pn instanceof IndexScanPlanNode);
ispn = (IndexScanPlanNode) pn;
assertEquals("DECODE_IDX3", ispn.getTargetIndexName());
assertEquals(3, ispn.getSearchKeyExpressions().size());
pn = compile("select * from l x, l where x.b = ? and DECODE(x.a, null, 0, x.a) = 0 and x.id = ? and l.lname = x.lname;");
//*enable to debug*/System.out.println("DEBUG: " + pn.toExplainPlanString());
// Skip the Send, Projection, and NestLoop plan nodes.
pn = pn.getChild(0).getChild(0).getChild(0);
assertTrue(pn instanceof IndexScanPlanNode);
ispn = (IndexScanPlanNode) pn;
assertEquals("DECODE_IDX3", ispn.getTargetIndexName());
assertEquals(3, ispn.getSearchKeyExpressions().size());
pn = compile("select * from l x, l where l.b = ? and DECODE(x.a, null, 0, x.a) = 0 and x.id = ? and l.lname = x.lname;");
//*enable to debug*/System.out.println("DEBUG: " + pn.toExplainPlanString());
leftIndexName = HSQLInterface.AUTO_GEN_NAMED_CONSTRAINT_IDX + "PK_LOG";
checkDualIndexedJoin(pn, leftIndexName, "DECODE_IDX3", 1);
pn = compile("select * from l x, l where l.b = ? and DECODE(x.a, null, 0, x.a) = 0 and l.id = ? and l.lname = x.lname;");
//*enable to debug*/System.out.println("DEBUG: " + pn.toExplainPlanString());
checkDualIndexedJoin(pn, "IDX_A", "DECODE_IDX3", 1);
pn = compile("select * from l x, l where x.b = ? and DECODE(l.a, null, 0, l.a) = 0 and x.id = ? and l.lname = x.lname;");
//*enable to debug*/System.out.println("DEBUG: " + pn.toExplainPlanString());
checkDualIndexedJoin(pn, "IDX_A", "DECODE_IDX3", 1);
pn = compile("select * from l x, l where l.b = ? and DECODE(x.a, null, 0, x.a) = 0 and l.id = ? and l.lname = x.lname;");
//*enable to debug*/System.out.println("DEBUG: " + pn.toExplainPlanString());
checkDualIndexedJoin(pn, "IDX_A", "DECODE_IDX3", 1);
pn = compile("select * from l x, l where x.b = ? and DECODE(l.a, null, 0, x.a) = 0 and x.id = ? and l.lname = x.lname;");
//*enable to debug*/System.out.println("DEBUG: " + pn.toExplainPlanString());
checkDualIndexedJoin(pn, "IDX_A", "DECODE_IDX3", 1);
pn = compile("select * from l x, l where l.b = ? and DECODE(x.a, null, 0, l.a) = 0 and l.id = ? and l.lname = x.lname;");
//*enable to debug*/System.out.println("DEBUG: " + pn.toExplainPlanString());
checkDualIndexedJoin(pn, "IDX_A", "DECODE_IDX3", 1);
pn = compile("select * from l x, l where x.b = ? and DECODE(l.a, null, 0, x.a) = 0 and x.id = ? and l.lname = x.lname;");
//*enable to debug*/System.out.println("DEBUG: " + pn.toExplainPlanString());
checkDualIndexedJoin(pn, "IDX_A", "DECODE_IDX3", 1);
pn = compile("select * from l x, l where l.b = ? and DECODE(x.a, null, 0, l.a) = 0 and x.id = ? and l.lname = x.lname;");
//*enable to debug*/System.out.println("DEBUG: " + pn.toExplainPlanString());
leftIndexName = HSQLInterface.AUTO_GEN_NAMED_CONSTRAINT_IDX + "PK_LOG";
checkDualIndexedJoin(pn, leftIndexName, "DECODE_IDX3", 1);
}
use of org.voltdb.plannodes.AbstractPlanNode in project voltdb by VoltDB.
the class TestIndexCoveringPlans method testCover3ColumnsInOrderWithLessThan.
public void testCover3ColumnsInOrderWithLessThan() {
AbstractPlanNode pn = compile("select a from t where a = ? and c = ? and 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.LT, ispn.getLookupType());
assertEquals(3, ispn.getSearchKeyExpressions().size());
}
use of org.voltdb.plannodes.AbstractPlanNode 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.AbstractPlanNode 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.AbstractPlanNode 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());
}
Aggregations