final String f = "%-30s %-15d [%.2fGB]"; // TableName -> TupleCount
// TableSize
final double gb = 1073741824d;
// First we need to generate a DependencyGraph
final DependencyGraph dgraph = this.generateDependencyGraph();
assert (dgraph.getVertexCount() == this.table_profiles.size());
// GraphVisualizationPanel.createFrame(dgraph).setVisible(true);
// Now loop through and generate our TableStatistics
final Map<Table, TableStatistics> stats = new HashMap<Table, TableStatistics>();
// First generate all the TableStatistics for tables without any
// dependencies
for (Entry<Table, TableProfile> e : this.table_profiles.entrySet()) {
Table catalog_tbl = e.getKey();
TableProfile profile = e.getValue();
if (profile.hasDependencies())
continue;
LOG.debug("Generating FIXED TableStatistics for " + e.getKey());
// There's not much we can do here other than this...
// If the table is not fixed, then modify the number of tuples by
// the scale factor
TableStatistics ts = new TableStatistics(catalog_tbl);
ts.tuple_count_total = Math.round(profile.tuple_count / (profile.is_fixed ? 1.0 : this.scale_factor));
ts.tuple_size_max = ts.tuple_size_min = ts.tuple_size_avg = MemoryEstimator.estimateTupleSize(catalog_tbl);
ts.tuple_size_total = ts.tuple_size_avg * ts.tuple_count_total;
stats.put(catalog_tbl, ts);
LOG.info(String.format(f, catalog_tbl.getName(), ts.tuple_count_total, ts.tuple_size_total / gb));
} // FOR
// Now traverse the DependencyGraph and generate the rest of the tables
for (DesignerVertex root : dgraph.getRoots()) {
new VertexTreeWalker<DesignerVertex, DesignerEdge>(dgraph, TraverseOrder.LONGEST_PATH) {
protected boolean hasVisited(DesignerVertex element) {
return (super.hasVisited(element) || stats.containsKey(element.getCatalogItem()));
};