use of org.voltdb.plannodes.AbstractScanPlanNode in project voltdb by VoltDB.
the class TestPlansScalarSubQueries method testSelectCorrelatedScalar.
public void testSelectCorrelatedScalar() {
AbstractPlanNode pn = compile("select r2.c, (select d from r1 where r1.c = r2.c ) scalar from r2");
pn = pn.getChild(0);
assertTrue(pn instanceof AbstractScanPlanNode);
AbstractPlanNode proj = pn.getInlinePlanNode(PlanNodeType.PROJECTION);
NodeSchema schema = proj.getOutputSchema();
assertEquals(2, schema.size());
SchemaColumn col = schema.getColumns().get(1);
assertTrue(col != null);
assertEquals("SCALAR", col.getColumnName());
AbstractExpression colExpr = col.getExpression();
assertEquals(ExpressionType.VALUE_SCALAR, colExpr.getExpressionType());
assertTrue(colExpr.getLeft() instanceof AbstractSubqueryExpression);
AbstractSubqueryExpression subqueryExpr = (AbstractSubqueryExpression) colExpr.getLeft();
List<Integer> params = subqueryExpr.getParameterIdxList();
assertEquals(1, params.size());
assertEquals(new Integer(0), params.get(0));
}
use of org.voltdb.plannodes.AbstractScanPlanNode in project voltdb by VoltDB.
the class TestPlansScalarSubQueries method testWhereUserParamScalar.
public void testWhereUserParamScalar() {
AbstractPlanNode pn = compile("select r2.c from r2 where r2.c = (select r1.a from r1 where r1.a = ?);");
pn = pn.getChild(0);
assertTrue(pn instanceof AbstractScanPlanNode);
AbstractExpression pred = ((AbstractScanPlanNode) pn).getPredicate();
assertEquals(ExpressionType.COMPARE_EQUAL, pred.getExpressionType());
assertEquals(ExpressionType.VALUE_TUPLE, pred.getLeft().getExpressionType());
assertEquals(ExpressionType.SELECT_SUBQUERY, pred.getRight().getExpressionType());
assertEquals(0, pred.getRight().getArgs().size());
}
use of org.voltdb.plannodes.AbstractScanPlanNode in project voltdb by VoltDB.
the class TestPlansScalarSubQueries method testSelectScalar.
public void testSelectScalar() {
AbstractPlanNode pn = compile("select r2.c, (select d from r1) scalar from r2");
pn = pn.getChild(0);
assertTrue(pn instanceof AbstractScanPlanNode);
AbstractPlanNode proj = pn.getInlinePlanNode(PlanNodeType.PROJECTION);
NodeSchema schema = proj.getOutputSchema();
assertEquals(2, schema.size());
SchemaColumn col = schema.getColumns().get(1);
assertTrue(col != null);
assertEquals("SCALAR", col.getColumnName());
}
use of org.voltdb.plannodes.AbstractScanPlanNode in project voltdb by VoltDB.
the class TestPlansJoin method testScanJoinConditions.
public void testScanJoinConditions() {
String query;
AbstractPlanNode pn;
AbstractPlanNode node;
AbstractScanPlanNode scan;
AbstractExpression predicate;
query = "SELECT * FROM R1 WHERE R1.C = 0";
pn = compileToTopDownTree(query, 3, PlanNodeType.SEND, PlanNodeType.SEQSCAN);
node = followAssertedLeftChain(pn, PlanNodeType.SEND, PlanNodeType.SEQSCAN);
scan = (AbstractScanPlanNode) node;
predicate = scan.getPredicate();
assertExprTopDownTree(predicate, ExpressionType.COMPARE_EQUAL, ExpressionType.VALUE_TUPLE, ExpressionType.VALUE_CONSTANT);
for (JoinOp joinOp : JoinOp.JOIN_OPS) {
perJoinOpTestScanJoinConditions(joinOp);
}
}
use of org.voltdb.plannodes.AbstractScanPlanNode in project voltdb by VoltDB.
the class TestPlansScalarSubQueries method testWhereEqualScalar.
public void testWhereEqualScalar() {
AbstractPlanNode pn = compile("select r2.c from r2 where (select r1.a from r1) = r2.c;");
pn = pn.getChild(0);
assertTrue(pn instanceof AbstractScanPlanNode);
AbstractExpression pred = ((AbstractScanPlanNode) pn).getPredicate();
assertEquals(ExpressionType.COMPARE_EQUAL, pred.getExpressionType());
assertEquals(ExpressionType.VALUE_TUPLE, pred.getLeft().getExpressionType());
assertEquals(ExpressionType.SELECT_SUBQUERY, pred.getRight().getExpressionType());
}
Aggregations