phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Localhost shell <>
Subject How to recreate the composite row key values into separate column values
Date Mon, 07 Apr 2014 22:28:29 GMT
Hey All,

I have a phoenix table with composite row key as A VARCHAR, B VARCHAR,
The data was inserted using Phoenix (version: *2.2.2*) Sql JDBC API.
Now there is a need to fetch data using HBase APIs.

*Is there a helper function in the Phoenix client codebase that I can reuse
to get the composite row key values? *
*i.e. giving the array of datatypes in the row key to a function and
getting the column values back.*

Also I can freely upgrade to a newer version, if the later version have
some helper code as this is not in production.

I have looked at the source code and I have observed that each VARCHAR
column value in row key is separated by a SEPARATOR_BYTE.
For Date/Time type datatypes the value is stored in a 8 byte long.

   byte[] rowkeybites = rr.getRow();
   //row key byte array: [67, 67, *0*, 65, 66, 78, 65, 77, 82, 79, 77, 67,
*0*, 0, 0, 1, 63, 22, -56, 104, 0]

This row key is made up of 3 column values: CC + ABNAMROMC + Time.

*Also without knowing the schema can I at least segregate the row keys into
different column value bytes by depending on SEPARATOR_BYTE?*

FYI, Currently I am researching Phoenix to use it in my project. I know
that PigLoader support is coming soon. I am doing this activity because I
foresee that I have to use MapReduce for some analysis activity and hence
want to know how easily I can reuse the existing tools and later on
contribute it back to Phoenix.


View raw message