Schema scoreSchema = new Schema();
scoreSchema.addColumn("deptname", Type.TEXT);
scoreSchema.addColumn("score", Type.INT4);
scoreMeta = CatalogUtil.newTableMeta(scoreSchema, StoreType.CSV);
TableStat stat = new TableStat();
Path p = sm.getTablePath("score");
sm.getFileSystem().mkdirs(p);
Appender appender = StorageManagerFactory.getStorageManager(conf).getAppender(scoreMeta, new Path(p, "score"));
appender.init();
int deptSize = 100;
int tupleNum = 10000;
Tuple tuple;
long written = 0;
for (int i = 0; i < tupleNum; i++) {
tuple = new VTuple(2);
String key = "test" + (i % deptSize);
tuple.put(0, DatumFactory.createText(key));
tuple.put(1, DatumFactory.createInt4(i + 1));
written += key.length() + Integer.SIZE;
appender.addTuple(tuple);
}
appender.close();
stat.setNumRows(tupleNum);
stat.setNumBytes(written);
stat.setAvgRows(tupleNum);
stat.setNumBlocks(1000);
stat.setNumPartitions(100);
scoreMeta.setStat(stat);
desc = new TableDescImpl("score", scoreMeta, p);
}