return (false);
}
Collection<Column> output_cols = PlanNodeUtil.getOutputColumnsForStatement(catalog_stmt);
assert (output_cols.isEmpty() == false);
for (Table catalog_tbl : tables) {
MaterializedViewInfo catalog_view = this.vp_views.get(catalog_tbl);
assert(catalog_view != null);
assert(catalog_view.getGroupbycols().isEmpty() == false) :
String.format("Missing vertical partitioning columns in %s when trying to process %s\n%s\nCACHED: %s",
catalog_view.fullName(), catalog_stmt.fullName(), CatalogUtil.debug(catalog_view), CatalogUtil.debug(this.vp_columns.get(catalog_tbl)));
Collection<Column> view_cols = CatalogUtil.getColumns(catalog_view.getGroupbycols());
assert(view_cols.isEmpty() == false) : "Missing vertical partitioning columns in " + catalog_view.fullName() + " when trying to process " + catalog_stmt.fullName();
Column partitioning_col = catalog_tbl.getPartitioncolumn();
assert(partitioning_col != null);
// The current vertical partition is valid for this query if all the
// following are true:
// (1) The partitioning_col is in output_cols
// (2) The partitioning_col is *not* in the predicate_cols
// (3) At least one of the vertical partition's columns is in
// predicate_cols
if (debug.val) {
Map<String, Object> m = new LinkedHashMap<String, Object>();
m.put("VerticalP", catalog_view.getName());
m.put("Partitioning Col", partitioning_col.fullName());
m.put("Output Cols", output_cols);
m.put("Statement Cols", stmt_cols);
m.put("VerticalP Cols", view_cols);
LOG.debug(String.format("Checking whether %s can use vertical partition for %s\n%s", catalog_stmt.fullName(), catalog_tbl.getName(), StringUtil.formatMaps(m)));
}
// if (output_cols.contains(partitioning_col) == false) {
// if (debug.val)
// LOG.warn("Output Columns do not contain horizontal partitioning column");
// }
// else
if (view_cols.containsAll(output_cols) == false) {
if (debug.val)
LOG.warn("Vertical Partition columns do not contain output columns");
}
/** Is this needed?
else if (stmt_cols.contains(partitioning_col) == true) {
if (debug.val)
LOG.warn("Statement Columns contains horizontal partition column");
}
**/
else if (view_cols.containsAll(stmt_cols) == false) {
if (debug.val)
LOG.warn("The Vertical Partition Columns does not contain all of the Statement Columns " + CollectionUtils.subtract(view_cols, stmt_cols));
}
else {
if (debug.val)
LOG.debug("Valid VP Candidate: " + catalog_tbl);
StatementRewrite rewrite = this.stmt_rewrites.get(catalog_stmt);
if (rewrite == null) {
rewrite = new StatementRewrite();
this.stmt_rewrites.put(catalog_stmt, rewrite);
}
rewrite.put(catalog_tbl, catalog_view.getDest());
}
} // FOR
// Check to make sure that we were able to generate a StatementRewrite candidate for this one
StatementRewrite rewrite = this.stmt_rewrites.get(catalog_stmt);