use of org.voltdb.expressions.AbstractSubqueryExpression 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.expressions.AbstractSubqueryExpression in project voltdb by VoltDB.
the class AbstractJoinPlanNode method generateOutputSchema.
@Override
public void generateOutputSchema(Database db) {
// Assert and provide functionality for generic join
assert (m_children.size() == 2);
for (AbstractPlanNode child : m_children) {
child.generateOutputSchema(db);
}
// Generate the output schema for subqueries
Collection<AbstractExpression> subqueryExpressions = findAllSubquerySubexpressions();
for (AbstractExpression expr : subqueryExpressions) {
((AbstractSubqueryExpression) expr).generateOutputSchema(db);
}
// Join the schema together to form the output schema
m_outputSchemaPreInlineAgg = m_children.get(0).getOutputSchema().join(m_children.get(1).getOutputSchema()).copyAndReplaceWithTVE();
m_hasSignificantOutputSchema = true;
generateRealOutputSchema(db);
}
use of org.voltdb.expressions.AbstractSubqueryExpression in project voltdb by VoltDB.
the class AbstractPlanNode method overrideId.
public int overrideId(int newId) {
m_id = newId++;
// Override subqueries ids
Collection<AbstractExpression> subqueries = findAllSubquerySubexpressions();
for (AbstractExpression expr : subqueries) {
assert (expr instanceof AbstractSubqueryExpression);
AbstractSubqueryExpression subquery = (AbstractSubqueryExpression) expr;
// overrideSubqueryNodeIds(newId) will get an NPE if the subquery
// has not been planned, presumably the effect of hitting a bug
// earlier in the planner. If that happens again, it MAY be useful
// to preempt those cases here and single-step through a replay of
// findAllSubquerySubexpressions. Determining where in the parent
// plan this subquery expression was found MAY provide a clue
// as to why the subquery was not planned. It has helped before.
//REDO to debug*/ if (subquery instanceof SelectSubqueryExpression) {
//REDO to debug*/ CompiledPlan subqueryPlan = ((SelectSubqueryExpression)subquery)
//REDO to debug*/ .getSubqueryScan().getBestCostPlan();
//REDO to debug*/ if (subqueryPlan == null) {
//REDO to debug*/ findAllSubquerySubexpressions();
//REDO to debug*/ }
//REDO to debug*/ }
newId = subquery.overrideSubqueryNodeIds(newId);
}
return newId;
}
Aggregations