Reputation: 139
For example, here is some records in a hbase table:
123, column=cf:dcol#0, value=aaaa
123, column=cf:dcol#1, value=bbbb
123, column=cf:dcol#2, value=cccc
123, column=cf:someOtherCol, value=dddd
The column dcol# is create dynamically by increasing the last digit.
Is there a way to get all the dcol# columns using native hbase lib without getting all the columns and knowing the number of dcol columns is available for this rowkey.
Thanks in advance for any input.
Upvotes: 2
Views: 48
Reputation: 3112
To achieve it you can use ColumnPrefixFilter. See example below
Get get = new Get(Bytes.toBytes(123));
get.addFamily(Bytes.toBytes("cf"));
get.setFilter(new ColumnPrefixFilter(Bytes.toBytes("dcol#")));
Result result = hTable.get(get);
.....
Upvotes: 1