phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanooj Padmakumar <p.san...@gmail.com>
Subject Re: how to decode phoenix data under hbase
Date Wed, 16 Mar 2016 15:13:24 GMT
Hi Kevin,

You can access the data created using phoenix with java hbase api .. Use
the sample code below..

Keep in mind for varchar (i.e. for columns whose size is unknown phoenix
uses separator) based columns we need to use
QueryConstants.SEPARATOR_BYTE_ARRAY as the separator and for number based
columns we dont need any separator (since phoenix keeps fixed size for such
columns)

byte[] startRow = ByteUtil.concat(PVarchar.INSTANCE
                    .toBytes("primaryKeyCol1Value"),
QueryConstants.SEPARATOR_BYTE_ARRAY,
                    PVarchar.INSTANCE.toBytes("primaryKeyCol2Value");

Get get = new Get(startRow);
Result result = table.get(get);

String colValue = Bytes.toString(result.getValue(Bytes.toBytes("colFamily"),
                    Bytes.toBytes("colName")));

Also read about PrefixFilter and range filters

Hope this helps

Sanooj


On Tue, Mar 15, 2016 at 2:33 PM, kevin <kiss.kevin119@gmail.com> wrote:

> HI,all
>     I create a table under phoenix and upsert somedata. I turn to hbase
> client and scan the new table.
>     I got data like :
>     column=0:NAME, timestamp=1458028540810, value=\xE5\xB0\x8F\xE6\x98\x8E
>
>     I don't know how to decode the value to normal string.what's the
> codeset?
>



-- 
Thanks,
Sanooj Padmakumar

Mime
View raw message