/**
* testHistograms
*/
public void testHistograms() throws Exception {
// Grab a txn with a JOIN
TransactionTrace xact_trace = null;
for (TransactionTrace xact : workload.getTransactions()) {
assertNotNull(xact);
if (xact.getCatalogItemName().equals(TARGET_PROCEDURES[2])) {
xact_trace = xact;
break;
}
} // FOR
assertNotNull(xact_trace);
// Change the catalog so that the data from the tables are in different partitions
Database clone_db = CatalogCloner.cloneDatabase(catalogContext.database);
assertNotNull(clone_db);
CatalogContext clone_catalogContext = new CatalogContext(clone_db.getCatalog());
Table catalog_tbl = clone_db.getTables().get(TM1Constants.TABLENAME_CALL_FORWARDING);
assertNotNull(catalog_tbl);
Column catalog_col = catalog_tbl.getColumns().get("START_TIME");
assertNotNull(catalog_col);
catalog_tbl.setPartitioncolumn(catalog_col);
// Throw the TransactionTrace at the costmodel and make sure that there is a TransactionCacheEntry
SingleSitedCostModel cost_model = new SingleSitedCostModel(clone_catalogContext);
cost_model.estimateTransactionCost(clone_catalogContext, xact_trace);
cost_model.setCachingEnabled(true);
TransactionCacheEntry entry = cost_model.getTransactionCacheEntry(xact_trace);
assertNotNull(entry);
// System.err.println(entry.toString());
// --------------------------
// Query Counters
// --------------------------
assertEquals(xact_trace.getQueries().size(), entry.getTotalQueryCount());
assertEquals(xact_trace.getQueries().size(), entry.getExaminedQueryCount());
assertEquals(0, entry.getSingleSiteQueryCount());
assertEquals(1, entry.getMultiSiteQueryCount());
// ---------------------------------------------
// Partitions Touched by Txns