private static void readProjection(int count) throws IOException,
ExecException, ParseException {
ColumnGroup.Reader reader = new ColumnGroup.Reader(path, conf);
reader.setProjection("col2, col3, foo, col1");
TableScanner scanner = reader.getScanner(null, true);
Tuple row = TypesUtils.createTuple(reader.getSchema());
BytesWritable key = new BytesWritable();
scanner.getKey(key);
String keyString = String.format("key%02d%02d", 1, 1);
Assert.assertTrue("Not equal to " + keyString, key
.equals(new BytesWritable(keyString.getBytes())));
TypesUtils.resetTuple(row);
scanner.getValue(row);
// physical 3, logical 2
String val3 = String.format("col3_%02d%02d", 1, 1);
Assert.assertEquals(val3, row.get(1));
// physical 2, logical 1
String mapKey = String.format("mapcolkey%02d%02d", 1, 1);
String mapVal = String.format("mapcolvalue%02d%02d", 1, 1);
Map<String, String> mapFld2 = (Map<String, String>) row.get(0);
Assert.assertEquals(mapVal, mapFld2.get(mapKey));
// physical NONE, logical 3
Assert.assertNull(row.get(2));
String simpVal = String.format("smpcol%02d%02d", 1, 1);
Assert.assertEquals(simpVal, row.get(3));
// move to next row
scanner.advance();
scanner.getValue(row);
simpVal = String.format("smpcol%02d%02d", 2, 1);
Assert.assertEquals(simpVal, row.get(3));
scanner.close();
scanner = null;
reader.close();
}