开发者

Hbase API,queries in Java, Help needed

开发者 https://www.devze.com 2023-03-20 08:40 出处:网络
I have using HBase to store file locations. For example: I have 8 Rows, the followings are the keys in HBase. Each folder location is a key.

I have using HBase to store file locations.

For example: I have 8 Rows, the followings are the keys in HBase. Each folder location is a key.

/usr/
开发者_开发问答/usr/folder1/
/usr/folder1/folder1_1/
/usr2/
/usr2/folder2/
/usr2/folder2/folder2_1/
/usr3/
/usr3/folder3/

How can I use HBase to get only the rows with specific depth? (like levels of subfolders)

So for depth 1: we would get rows with keys: /usr/, /usr2/, /usr3/ 
depth 1 for /usr/: we would get /usr/folder1/
depth 2 for /usr/: we could get /usr/folder1/folder1_1/

Can someone show me some demo code please? Such as using scanner or filter?

Many thanks!


I haven't personally worked in HBase much, but you basically need to do a scan with a REGEX filter. Not sure if you can do that from the HBase shell or not, but you could definitely do it using API's.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号