phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anil gupta <anilgupt...@gmail.com>
Subject Re: how to decode phoenix data under hbase
Date Wed, 16 Mar 2016 18:35:51 GMT
Hi Kevin,

You should use Phoenix commandline(squirrel) or Phoenix api to read data
written via Phoenix. One of the biggest advantage of Phoenix is that it
converts long, int, date, etc into a human readable format at the time of
displaying data(unlike binary in HBase). Have a look at Phoenix website to
find out how to use Phoenix to query data.

Thanks,
Anil

On Wed, Mar 16, 2016 at 8:13 AM, Sanooj Padmakumar <p.sanooj@gmail.com>
wrote:

> 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
>



-- 
Thanks & Regards,
Anil Gupta

Mime
View raw message