adaltas / node-hbase

Asynchronous HBase client for NodeJs using REST

Home Page:https://hbase.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SingleColumnValueFilter Support

Link66 opened this issue · comments

commented

let filter = {
filter: {
"type": "SingleColumnValueFilter",
"op": "EQUAL",
"family": "cf",
"qualifier": "userid",
"comparator": {
"type": "BinaryComparator",
"value": "xxxxxxxx"
}
}
}
hbaseClient.table(tableName).scan(filter,(error, data) => { console.log(error); console.log(data); });
Execute the above code will return all the data in the database, it seems that the SingleColumnValueFilter didn't work, i don't know whether i missed some params.

commented

let filter = { filter: { "type": "ValueFilter", "op": "EQUAL", "family": "cf", "qualifier": "userid", "comparator": { "type": "BinaryComparator", "value": "xxxxxxxxxxx" } } };
result:
image

And using the ValueFilter will only get one cell, but i want to get all family data. My goal is to filter out the row data with the value I defined.

commented

On, it's my fault. I have missed the base64 encode.For 'filter', the lib hbase will encode the follwing params, and others should be encode by ourselves.
if (k === 'value' && (!obj['type'] || obj['type'] !== 'RegexStringComparator' && obj['type'] !== 'PageFilter')) { results.push(obj[k] = utils.base64.encode(obj[k], encoding)); }