Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

reading back salted column in hbase

Highlighted

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 ?

6 REPLIES 6

Re: reading back salted column in hbase

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

Re: reading back salted column in hbase

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?

Re: reading back salted column in hbase

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.

Re: reading back salted column in hbase

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;
  ACCT_NUM     PUR_ID
---------- ----------
   1001181  752545412
SQL>

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  |


Re: reading back salted column in hbase

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.

Re: reading back salted column in hbase

Master Collaborator

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