List<AbstractExpression> output_exps = new ArrayList<AbstractExpression>();
if (scan_node.getOutputColumnGUIDs().isEmpty()) {
if (scan_node.getInlinePlanNode(PlanNodeType.PROJECTION) != null) {
ProjectionPlanNode proj_node = (ProjectionPlanNode) scan_node.getInlinePlanNode(PlanNodeType.PROJECTION);
for (int guid : proj_node.getOutputColumnGUIDs()) {
PlanColumn column = PlannerContext.singleton().get(guid);
assert (column != null);
output_cols.add(column);
output_exps.add(column.getExpression());
} // FOR
}
} else {
for (int guid : scan_node.getOutputColumnGUIDs()) {
PlanColumn column = PlannerContext.singleton().get(guid);
assert (column != null);
output_cols.add(column);
output_exps.add(column.getExpression());
} // FOR
}
for (int i = 0, cnt = output_cols.size(); i < cnt; i++) {
PlanColumn column = output_cols.get(i);
AbstractExpression exp = output_exps.get(i);
// Skip TupleAddressExpression
if (!(exp instanceof TupleAddressExpression)) {
//
// Make a temporary expression where COL = Expression
// Har har har! I'm so clever!
//
String column_name = (column.originColumnName() != null ? column.originColumnName() : column.getDisplayName());
Column catalog_col = catalog_tbl.getColumns().get(column_name);
if (catalog_col == null)
System.err.println(catalog_tbl + ": " + CatalogUtil.debug(catalog_tbl.getColumns()));
assert (catalog_col != null) : "Missing column '" + catalog_tbl.getName() + "." + column_name + "'";
AbstractExpression root_exp = CatalogUtil.createTempExpression(catalog_col, exp);