alibaba / alibaba/node-hbase-client
FamilyFilter can't be created on the client
- Dominant language
- JavaScript
- Stars
- 279
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
I need a scan limited to one column family only.
I want to do something like this:
```
var scan = client.getScanner(topicTokens.table),
var f = {
familyFilter: {
compareFilter: {
compareOp: 'EQUAL',
comparator: {
substringComparator: {
substr: topicTokens.family
}
}
}
}
};
scan.setFilter(f);
```
But this gives me invalid field exceptions. I have to do something like this:
```
var scan = client.getScanner(topicTokens.table),
//singleColumnValueFilter is treated as special in scan.js so we have to
//use it to serialize the comparator (we can't do it directly).
var dummy = {
singleColumnValueFilter: {
compareOp: "EQUAL",
comparator: {
substringComparator: {
substr: topicTokens.family
}
}
}
}
scan.setFilter(dummy);
var f = {
familyFilter: {
compareFilter: {
compareOp: 'EQUAL',
comparator: dummy.singleColumnValueFilter.comparator
}
}
};
scan.setFilter(f);
```
I am not sure if I have missed another way of doing this. If so, I'd like to know how please.
The serialisation could be fixed to do this as in my first example, or you could expose scan.getFilter() and allow me to serialise it by hand. I wasn't sure of the rational behind making singleColumnValueFilter a special case.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in scan.js, where singleColumnValueFilter is described as a special serialization case, and compare that path with the familyFilter structure shown in the issue. Reproduce the invalid field exception using the first example; done means a FamilyFilter can be serialized and passed to setFilter without the workaround, or the supported alternative is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100