}
}
@Test
public void testProjection() throws IOException {
Schema schema = new Schema();
schema.addColumn("id", Type.INT4);
schema.addColumn("age", Type.INT8);
schema.addColumn("score", Type.FLOAT4);
TableMeta meta = CatalogUtil.newTableMeta(schema, storeType);
Path tablePath = new Path(testDir, "testProjection.data");
Appender appender = StorageManagerFactory.getStorageManager(conf).getAppender(meta, tablePath);
appender.init();
int tupleNum = 10000;
VTuple vTuple;
for(int i = 0; i < tupleNum; i++) {
vTuple = new VTuple(3);
vTuple.put(0, DatumFactory.createInt4(i + 1));
vTuple.put(1, DatumFactory.createInt8(i + 2));
vTuple.put(2, DatumFactory.createFloat4(i + 3));
appender.addTuple(vTuple);
}
appender.close();
FileStatus status = fs.getFileStatus(tablePath);
Fragment fragment = new Fragment("testReadAndWrite", tablePath, meta, 0, status.getLen());
Schema target = new Schema();
target.addColumn("age", Type.INT8);
target.addColumn("score", Type.FLOAT4);
Scanner scanner = StorageManagerFactory.getStorageManager(conf).getScanner(meta, fragment, target);
scanner.init();
int tupleCnt = 0;
Tuple tuple;
while ((tuple = scanner.next()) != null) {