catalog_proc.setPartitionparameter(mpp.getIndex());
// First Test: Only partition one of the tables and make sure that
// the MultiColumns don't map to the same partition
Table catalog_tbl = this.getTable(clone_db, TM1Constants.TABLENAME_SPECIAL_FACILITY);
Column catalog_cols[] = new Column[] {
this.getColumn(clone_db, catalog_tbl, "S_ID"),
this.getColumn(clone_db, catalog_tbl, "SF_TYPE"),
};
MultiColumn mc = MultiColumn.get(catalog_cols);
assertNotNull(mc);
catalog_tbl.setPartitioncolumn(mc);
p_estimator.initCatalog(clone_catalogContext);
Statement catalog_stmt = this.getStatement(clone_db, catalog_proc, "GetData");
Long params[] = new Long[] {
new Long(1111), // S_ID
new Long(1111), // S_ID
new Long(2222), // SF_TYPE
new Long(3333), // START_TIME
new Long(4444), // END_TIME
};
Map<String, PartitionSet> partitions = p_estimator.getTablePartitions(catalog_stmt, params, base_partition);
assertNotNull(partitions);
assertFalse(partitions.isEmpty());
PartitionSet touched = new PartitionSet();
for (String table_key : partitions.keySet()) {
assertFalse(table_key, partitions.get(table_key).isEmpty());
touched.addAll(partitions.get(table_key));
} // FOR
assertEquals(2, touched.size());
// Second Test: Now make the other table multi-column partitioned and make
// sure that the query goes to just one partition
catalog_tbl = this.getTable(clone_db, TM1Constants.TABLENAME_CALL_FORWARDING);
catalog_cols = new Column[] {
this.getColumn(clone_db, catalog_tbl, "S_ID"),
this.getColumn(clone_db, catalog_tbl, "SF_TYPE"),
};
mc = MultiColumn.get(catalog_cols);
assertNotNull(mc);
catalog_tbl.setPartitioncolumn(mc);
p_estimator.initCatalog(clone_catalogContext);
partitions = p_estimator.getTablePartitions(catalog_stmt, params, base_partition);
assertNotNull(partitions);
assertFalse(partitions.isEmpty());