6.9 获取某一行指定列的数据
private static void getDataByColumn(String tableName, String row, String cf, String c) throws IOException {
Table table = conn.getTable(TableName.valueOf(tableName));
Get get = new Get(Bytes.toBytes(row));
get.addColumn(Bytes.toBytes(cf), Bytes.toBytes(c));
Result result = table.get(get);
List<Cell> cells = result.listCells();
for (Cell cell : cells) {
String family = Bytes.toString(CellUtil.cloneFamily(cell));
String value = Bytes.toString(CellUtil.cloneValue(cell));
String rowName = Bytes.toString(CellUtil.cloneRow(cell));
String column = Bytes.toString(CellUtil.cloneQualifier(cell));
System.out.println("column = " + column);
System.out.println("rowName = " + rowName);
System.out.println("value = " + value);
System.out.println("family = " + family);
}
}