0
votes

I have a rowkey issue when i salt a phoenix table and insert data directly from hbase.

Here is the scenario:

1- Create a table on phoenix with salt_buckets=16

2- The data is inserted in the hbase table by a storm hbase bolt. The hbasebolt insert data directly in hbase without passing by phoenix.

The problem is the phoenix rowkey always missing the first character compared to thehbase rowkey, when i run a select query on phoenix

Example:

  • hbase rowkey: 1f05d01f-6a17-4d7b-8d97-df32d8856666
  • phoenix rowkey: f05d01f-6a17-4d7b-8d97-df32d8856666

I look forward getting a response guys. Thank you in advance.

Kind regards,

1
what version of hbase and phoenix? and if you use hbase bolt, that's expected, you need to pad the bits. - Paul Bastide
i work with hbase 1.1.2 and phoenix 4.7 on Ambari cluster . How to pad the bits ? - wessbac
@PaulBastide: Could you please tell me the way to pad the bits ? thanks in advance - wessbac

1 Answers

1
votes

If you intend to query data using Apache Phoenix, write the data to that table via Phoenix APIs.

When you write data to a Phoenix table via Phoenix APIs, it does many things, among which it:

  1. Ensures that the data you wrote matches the schema of the table you're writing to
  2. Updates any secondary indexes
  3. Encodes columns names in the manner that Phoenix expects
  4. Updates statistics that describe the physical distribution of data in that table for future query planning

When you write data directly to the Phoenix table via HBase APIs, you bypass all of these constructs. At best, your queries via Phoenix will fail with an obvious deserialization error. At worst, stale indexes will be used to answer a query which return you incorrect results.