String projection1 = new String("a,b,c");
BasicTable.Reader reader = new BasicTable.Reader(pathTable1, conf);
reader.setProjection(projection1);
List<RangeSplit> splits = reader.rangeSplit(1);
TableScanner scanner = reader.getScanner(splits.get(0), true);
scanner = reader.getScanner(splits.get(0), true);
BytesWritable key = new BytesWritable();
Tuple RowValue = TypesUtils.createTuple(scanner.getSchema());
scanner.getKey(key);
// Assert.assertEquals(key, new BytesWritable("k11".getBytes()));
System.out.println("read record or record:" + RowValue.toString());
for (int i = 0; i <= 9; i++) {
scanner.getValue(RowValue);
System.out.println("read record or record:" + RowValue.toString());
Assert.assertEquals(i + "_00", RowValue.get(0));
Assert.assertEquals(i + "_01", RowValue.get(1));
Assert.assertEquals(i + "_02", RowValue.get(2));
scanner.advance();
}
for (int i = 0; i <= 9; i++) {
scanner.getValue(RowValue);
System.out.println("read record or record:" + RowValue.toString());
Assert.assertEquals(i + "_10", RowValue.get(0));
Assert.assertEquals(i + "_11", RowValue.get(1));
Assert.assertEquals(i + "_12", RowValue.get(2));
scanner.advance();
}
reader.close();
}