I have column family as cf1
, and I want to access all the columns with in that row where EqID='Eq1'
, I have used ValueFilter , but it only return me the EqID column.
hbase(main):004:0> scan 'abc', { COLUMNS => ['cf1:Value', 'cf1:EqID'],FILTER => "ValueFilter( =, 'binaryprefix:Eq1' )" }
ROW COLUMN+CELL
row1 column=cf1:EqID, timestamp=1401092981867, value=Eq1
Above i got the row1 but not column Value ,Similarly with get,
get 'abc', 'row1', {FILTER => "ValueFilter( =, 'binaryprefix:Eq1' )"}
COLUMN CELL
cf1:EqID timestamp=1401092981867, value=Eq1
1 row(s) in 0.0120 seconds
I didn't get the value of Value column. Is it possible to get the value of other column,where the condition of 1 column meet? Is it possible or row key is the only way?
Thanks.
You can use SingleColumnValueFilter for this.
If you are using java then you can look the following code
HTable hTable = new HTable(conf, Bytes.toBytes("tableName"));
Filter f = new SingleColumnValueFilter(Bytes.toBytes("EqID"), Bytes.toBytes("EqID"), CompareOp.EQUAL, Bytes.toBytes("Eq1"));
Scan s = new Scan();
s.setFilter(f);
ResultScanner scanner = hTable.getScanner(s);
for (Result r : scanner)
{
System.out.println(Bytes.toString(r.getValue(Bytes.toBytes("EqID"), Bytes.toBytes("EqID"))));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.