use of org.voltdb.plannodes.SeqScanPlanNode in project voltdb by VoltDB.
the class TestPlansDML method checkPredicate.
private void checkPredicate(AbstractPlanNode pn, ExpressionType type) {
assertTrue(pn instanceof SeqScanPlanNode);
AbstractExpression e = ((SeqScanPlanNode) pn).getPredicate();
assertEquals(type, e.getExpressionType());
}
use of org.voltdb.plannodes.SeqScanPlanNode in project voltdb by VoltDB.
the class TestPlansDML method checkDMLPlanNodeAndSubqueryExpression.
void checkDMLPlanNodeAndSubqueryExpression(String dmlSQL, ExpressionType filterType) {
List<AbstractPlanNode> pns = compileToFragments(dmlSQL);
AbstractPlanNode dmlNode;
if (pns.size() == 2) {
dmlNode = pns.get(1).getChild(0);
} else {
dmlNode = pns.get(0);
}
String dmlType = dmlSQL.substring(0, dmlSQL.indexOf(' ')).trim().toUpperCase();
if ("UPSERT".equalsIgnoreCase(dmlType)) {
// UPSERT is INSERT
dmlType = "INSERT";
}
// it could be extended in some way.
if ((dmlNode instanceof SeqScanPlanNode) && "INSERT".equals(dmlType)) {
assertNotNull("Expected an insert node.", dmlNode.getInlinePlanNode(PlanNodeType.INSERT));
} else {
assertEquals(dmlType, dmlNode.getPlanNodeType().toString());
}
PlanNodeType nodeType = dmlNode.getPlanNodeType();
while (nodeType != PlanNodeType.SEQSCAN && nodeType != PlanNodeType.MATERIALIZE && nodeType != PlanNodeType.INDEXSCAN) {
dmlNode = dmlNode.getChild(0);
nodeType = dmlNode.getPlanNodeType();
}
assertNotNull(dmlNode);
// Verify DML Predicate
if (filterType != null) {
AbstractExpression predicate = ((AbstractScanPlanNode) dmlNode).getPredicate();
assertNotNull(predicate);
assertEquals(filterType, predicate.getExpressionType());
assertTrue(predicate.hasAnySubexpressionOfClass(SelectSubqueryExpression.class));
}
}
use of org.voltdb.plannodes.SeqScanPlanNode in project voltdb by VoltDB.
the class TestPlansInExistsSubQueries method verifyTrivialSchemaLimitOffset.
private void verifyTrivialSchemaLimitOffset(AbstractExpression exists, int limit, int offset) {
assertNotNull(exists);
assertEquals(ExpressionType.OPERATOR_EXISTS, exists.getExpressionType());
AbstractSubqueryExpression se = (AbstractSubqueryExpression) exists.getLeft();
AbstractPlanNode pn = se.getSubqueryNode();
assertTrue(pn instanceof SeqScanPlanNode);
AbstractPlanNode inline = pn.getInlinePlanNode(PlanNodeType.PROJECTION);
assertNotNull(inline);
inline = pn.getInlinePlanNode(PlanNodeType.LIMIT);
assertNotNull(inline);
assertEquals(limit, ((LimitPlanNode) inline).getLimit());
assertEquals(offset, ((LimitPlanNode) inline).getOffset());
}
use of org.voltdb.plannodes.SeqScanPlanNode in project voltdb by VoltDB.
the class PlannerTestCase method assertReplicatedLeftJoinCoordinator.
/**
* Assert that a two-fragment plan's coordinator fragment does a left join
* with a specific replicated table on its outer side.
**/
protected static void assertReplicatedLeftJoinCoordinator(List<AbstractPlanNode> lpn, String replicatedTable) {
AbstractPlanNode pn;
AbstractPlanNode node;
NestLoopPlanNode nlj;
SeqScanPlanNode seqScan;
pn = lpn.get(0);
assertTopDownTree(pn, PlanNodeType.SEND, PlanNodeType.PROJECTION, PlanNodeType.NESTLOOP, PlanNodeType.SEQSCAN, PlanNodeType.RECEIVE);
node = followAssertedLeftChain(pn, PlanNodeType.SEND, PlanNodeType.PROJECTION, PlanNodeType.NESTLOOP);
nlj = (NestLoopPlanNode) node;
assertEquals(JoinType.LEFT, nlj.getJoinType());
assertEquals(2, nlj.getChildCount());
seqScan = (SeqScanPlanNode) nlj.getChild(0);
assertEquals(replicatedTable, seqScan.getTargetTableName().toUpperCase());
}
use of org.voltdb.plannodes.SeqScanPlanNode in project voltdb by VoltDB.
the class TestJoinOrder method testOuterJoinOrder.
public void testOuterJoinOrder() {
AbstractPlanNode pn = compileSPWithJoinOrder("select * FROM T1 LEFT JOIN T2 ON T1.A = T2.B", "T1, T2");
AbstractPlanNode n = pn.getChild(0).getChild(0);
assertTrue(((SeqScanPlanNode) n.getChild(0)).getTargetTableName().equals("T1"));
assertTrue(((SeqScanPlanNode) n.getChild(1)).getTargetTableName().equals("T2"));
try {
compileWithInvalidJoinOrder("select * FROM T1 LEFT JOIN T2 ON T1.A = T2.B", "T2, T1");
fail();
} catch (Exception ex) {
assertTrue("The specified join order is invalid for the given query".equals(ex.getMessage()));
}
}
Aggregations