/** check aggregate column offsets **/
for (Integer col_guid : ((AggregatePlanNode) node).getAggregateColumnGuids()) {
PlanColumn plan_col = PlannerContext.singleton().get(col_guid);
assert (plan_col.getExpression().getExpressionType().equals(ExpressionType.VALUE_TUPLE)) : " plan column expression type is: " + plan_col.getExpression().getExpressionType()
+ " NOT TupleValueExpression";
TupleValueExpression tv_exp = (TupleValueExpression) plan_col.getExpression();
checkColumnIndex(tv_exp, tbl_map);
}
/** check output column offsets **/
for (Integer col_guid : ((AggregatePlanNode) node).getAggregateOutputColumns()) {
PlanColumn plan_col = PlannerContext.singleton().get(col_guid);
assert (plan_col.getExpression().getExpressionType().equals(ExpressionType.VALUE_TUPLE)) : " plan column expression type is: " + plan_col.getExpression().getExpressionType()
+ " NOT TupleValueExpression";
TupleValueExpression tv_exp = (TupleValueExpression) plan_col.getExpression();
checkColumnIndex(tv_exp, tbl_map);
}
/** check group by column offsets **/
for (Integer col_guid : ((AggregatePlanNode) node).getGroupByColumnOffsets()) {
PlanColumn plan_col = PlannerContext.singleton().get(col_guid);
assert (plan_col.getExpression().getExpressionType().equals(ExpressionType.VALUE_TUPLE)) : " plan column expression type is: " + plan_col.getExpression().getExpressionType()
+ " NOT TupleValueExpression";
TupleValueExpression tv_exp = (TupleValueExpression) plan_col.getExpression();
checkColumnIndex(tv_exp, tbl_map);
}
/** Order By's **/
} else if (node instanceof OrderByPlanNode) {
} else {
// check the offsets of the output column
// Set<TupleValueExpression> ExpressionUtil.getExpressions(node,
// TupleValueExpression.class);
for (Integer col_guid : node.getOutputColumnGUIDs()) {
PlanColumn plan_col = PlannerContext.singleton().get(col_guid);
new ExpressionTreeWalker() {
@Override
protected void callback(AbstractExpression element) {
if (element.getClass().equals(TupleValueExpression.class)) {
assert (element.getExpressionType().equals(ExpressionType.VALUE_TUPLE)) : "plan column expression type is: " + element.getExpressionType() + " NOT TupleValueExpression";
TupleValueExpression tv_exp = (TupleValueExpression) element;
checkColumnIndex(tv_exp, tbl_map);
}
return;
}
}.traverse(plan_col.getExpression());