use of org.voltdb.plannodes.MergeReceivePlanNode in project voltdb by VoltDB.
the class TestPlansOrderBy method validateAggregatedMergeReceive.
private void validateAggregatedMergeReceive(AbstractPlanNode pn, boolean hasSerialAggr, boolean hasPartialAggr, boolean hasProj, boolean hasLimit) {
assertEquals(PlanNodeType.MERGERECEIVE, pn.getPlanNodeType());
MergeReceivePlanNode rpn = (MergeReceivePlanNode) pn;
assertNotNull(rpn.getInlinePlanNode(PlanNodeType.ORDERBY));
assertEquals(hasSerialAggr, rpn.getInlinePlanNode(PlanNodeType.AGGREGATE) != null);
assertEquals(hasPartialAggr, rpn.getInlinePlanNode(PlanNodeType.PARTIALAGGREGATE) != null);
assertEquals(hasProj, rpn.getInlinePlanNode(PlanNodeType.PROJECTION) != null);
if (hasSerialAggr || hasPartialAggr) {
AbstractPlanNode aggrNode = (hasSerialAggr) ? rpn.getInlinePlanNode(PlanNodeType.AGGREGATE) : rpn.getInlinePlanNode(PlanNodeType.PARTIALAGGREGATE);
assertEquals(hasLimit, aggrNode.getInlinePlanNode(PlanNodeType.LIMIT) != null);
} else {
assertEquals(hasLimit, rpn.getInlinePlanNode(PlanNodeType.LIMIT) != null);
}
}
use of org.voltdb.plannodes.MergeReceivePlanNode in project voltdb by VoltDB.
the class TestPlansOrderBy method validateMergeReceive.
private void validateMergeReceive(AbstractPlanNode pn, boolean hasLimit, int[] sortColumnIdx) {
assertEquals(PlanNodeType.MERGERECEIVE, pn.getPlanNodeType());
MergeReceivePlanNode rpn = (MergeReceivePlanNode) pn;
assertNotNull(rpn.getInlinePlanNode(PlanNodeType.ORDERBY));
assertEquals(hasLimit, rpn.getInlinePlanNode(PlanNodeType.LIMIT) != null);
OrderByPlanNode opn = (OrderByPlanNode) rpn.getInlinePlanNode(PlanNodeType.ORDERBY);
List<AbstractExpression> ses = opn.getSortExpressions();
assertEquals(sortColumnIdx.length, ses.size());
int idx = 0;
List<AbstractExpression> sesTves = new ArrayList<>();
for (AbstractExpression se : ses) {
sesTves.addAll(se.findAllTupleValueSubexpressions());
}
assertEquals(sortColumnIdx.length, sesTves.size());
for (AbstractExpression seTve : sesTves) {
assertEquals(sortColumnIdx[idx++], ((TupleValueExpression) seTve).getColumnIndex());
}
}
use of org.voltdb.plannodes.MergeReceivePlanNode in project voltdb by VoltDB.
the class TestPlansLimit method checkInlineLimitAndOrderbyWithReceive.
private void checkInlineLimitAndOrderbyWithReceive(List<AbstractPlanNode> pns, boolean pushdown) {
AbstractPlanNode p;
p = pns.get(0).getChild(0);
assertTrue(p instanceof ProjectionPlanNode);
p = p.getChild(0);
assertTrue(p instanceof MergeReceivePlanNode);
assertNotNull(p.getInlinePlanNode(PlanNodeType.LIMIT));
assertNotNull(p.getInlinePlanNode(PlanNodeType.ORDERBY));
if (pushdown) {
assertEquals(2, pns.size());
p = pns.get(1).getChild(0);
assertTrue(p instanceof OrderByPlanNode);
assertNotNull(p.getInlinePlanNode(PlanNodeType.LIMIT));
} else if (pns.size() == 2) {
p = pns.get(1).getChild(0);
assertFalse(p.toExplainPlanString().toLowerCase().contains("limit"));
}
}
Aggregations