Collection<Column> ret = CACHE_OUTPUT_COLUMNS.get(catalog_stmt);
if (ret == null && catalog_stmt.getQuerytype() == QueryType.SELECT.getValue()) {
// It's easier to figure things out if we use the single-partition
// query plan
final Database catalog_db = CatalogUtil.getDatabase(catalog_stmt);
final AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, true);
assert (root != null);
assert (root instanceof SendPlanNode) : "Unexpected PlanNode root " + root + " for " + catalog_stmt.fullName();
// We need to examine down the tree to figure out what this thing
// shoving out to the outside world
assert (root.getChildPlanNodeCount() == 1) : "Unexpected one child for " + root + " for " + catalog_stmt.fullName() + " but it has " + root.getChildPlanNodeCount();
ret = Collections.unmodifiableCollection(PlanNodeUtil.getOutputColumnsForPlanNode(catalog_db, root.getChild(0)));
CACHE_OUTPUT_COLUMNS.put(catalog_stmt, ret);
}
return (ret);
}