// Initialize the MapOutput table
// Create an invocation of the VoltMapProcedure so that we can grab
// the MapOutput's schema
VoltTable.ColumnInfo[] schema = mrInstance.getMapOutputSchema();
String tableMapOutput = "MAP_" + procedure.getName();
Table catalog_tbl = catalog_db.getTables().add(tableMapOutput);
assert (catalog_tbl != null);
for (int i = 0; i < schema.length; i++) {
Column catalog_col = catalog_tbl.getColumns().add(schema[i].getName());
catalog_col.setIndex(i);
catalog_col.setNullable(i > 0);
catalog_col.setType(schema[i].getType().getValue());
if (i == 0)
catalog_tbl.setPartitioncolumn(catalog_col);
} // FOR
catalog_tbl.setMapreduce(true);
catalog_tbl.setIsreplicated(false);
// Initialize the reduceOutput table
VoltTable.ColumnInfo[] schema_reduceOutput = mrInstance.getReduceOutputSchema();
String tableReduceOutput = "REDUCE_" + procedure.getName();
catalog_tbl = catalog_db.getTables().add(tableReduceOutput);
assert (catalog_tbl != null);
for (int i = 0; i < schema_reduceOutput.length; i++) {
Column catalog_col = catalog_tbl.getColumns().add(schema_reduceOutput[i].getName());
catalog_col.setIndex(i);
catalog_col.setNullable(i > 0);
catalog_col.setType(schema_reduceOutput[i].getType().getValue());
if (i == 0)
catalog_tbl.setPartitioncolumn(catalog_col);
} // FOR
catalog_tbl.setMapreduce(true);
catalog_tbl.setIsreplicated(false);
// Initialize the Procedure catalog object
procedure.setMapinputquery(info.mapInputQuery);
procedure.setMapemittable(tableMapOutput);
procedure.setReduceemittable(tableReduceOutput);