Support Questions
Find answers, ask questions, and share your expertise

reading back salted column in hbase

Master Collaborator

how do I read a salted rowkey in hbase since it changes the actual row key value ?


You don't -- use Phoenix APIs if you want to read Phoenix data.

Master Collaborator

but I am using Phoenix to read the data "select * from tab2 where acct_num=???? " . the acct_num (which is the row key) value is not the same as the actual value so how can search for it from Phoenix?

Phoenix knows how it has serialized the data and how to query for it. It's a feature of Phoenix that it's abstracting away data storage for you.

Master Collaborator

if I create the table with the salted value then please see below the acc_num value is different from the source table and if I try to do a select acct_num from tab where acct_num='10001181' does not give any result since the acc_num is stored as '001181' in phoenix ?

SQL> select acct_num,pur_id from tab4 where acct_num=1001181;
---------- ----------
   1001181  752545412

0: jdbc:phoenix:hadoop1:2181:/hbase-unsecure> select acct_num,pur_id from PUR_ACCT_PHX2 limit 10;
| ACCT_NUM  |   PUR_ID   |
| 001181    | 752545412  |
| 002226    | 752541376  |

Again, because you have written invalid data directly into HBase, expecting Phoenix to somehow magically know how to deserialize it. If you want to use Phoenix, write your data via Phoenix.

Master Collaborator

so you mean we can't use Phoenix if we load data via sqoop since sqoop doesn't have any phoenix drivers?

; ;