You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Localhost shell <un...@gmail.com> on 2014/04/08 00:28:29 UTC

How to recreate the composite row key values into separate column values

Hey All,

I have a phoenix table with composite row key as A VARCHAR, B VARCHAR,
DATELOGGED TIME
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.


Unilocal

Re: How to recreate the composite row key values into separate column values

Posted by James Taylor <ja...@apache.org>.
The RowKeySchema class in Phoenix manages iterating through the column
values in the row key. I'd definitely recommend upgrading to a later
version, as there are a lot of bug fixes and lots of new functionality. The
work PHOENIX-11 to enhance our Pig integration is pretty far along too and
will likely be committed soon if you want to wait for that. Otherwise,
using RowKeySchema to iterate is your best bet.
Thanks,
James

On Mon, Apr 7, 2014 at 3:28 PM, Localhost shell <
universal.localhost@gmail.com> wrote:

> Hey All,
>
> I have a phoenix table with composite row key as A VARCHAR, B VARCHAR,
> DATELOGGED TIME
> 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.
>
>
> Unilocal
>