Created 08-07-2018 02:14 PM
Is there a possibility to query a salted HBase table by using the HBase Shell.
E.g. my HBase table row key looks like this:
000:rowkey0 000:rowkey2 ... 001:rowkey1 001:rowkey3 ...
How can I use my HBase Shell to query this table without doing a full table scan, e.g. when I want to read out the row with rowkey1? Thank you!
Created 08-07-2018 03:31 PM
You don't need to scan the entire table if you can enumerate the values of salt that you used. E.g. if you only use salt 000 through 009, you would have to execute 10 Gets to look for the data, 000:rowkey1, 001:rowkey1, 002:rowkey1, 003:rowkey1, ...
If you used a stable hashing algorithm to choose a salt based on the rowkey value, you will know the exact salt value to use (e.g. rowkey1 always generates salt "004").
At the end of the day, HBase is only storing bytes -- it's up to you to know how you inserted the data and need to retrieve it.
Created 08-07-2018 03:31 PM
You don't need to scan the entire table if you can enumerate the values of salt that you used. E.g. if you only use salt 000 through 009, you would have to execute 10 Gets to look for the data, 000:rowkey1, 001:rowkey1, 002:rowkey1, 003:rowkey1, ...
If you used a stable hashing algorithm to choose a salt based on the rowkey value, you will know the exact salt value to use (e.g. rowkey1 always generates salt "004").
At the end of the day, HBase is only storing bytes -- it's up to you to know how you inserted the data and need to retrieve it.
Created 08-07-2018 03:31 PM
have a look here: https://community.hortonworks.com/questions/88526/how-to-salt-row-key-in-hbase-table.html
Basically it says that your prefix definition should be made in a way that you can calculate it during the query as well. In your (but perhaps simplified) example it might be even numbers prefix 000, odd numbers prefix 001.