You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by George Lu <lu...@gmail.com> on 2015/05/03 16:49:25 UTC

Re: Some questions on CONVERT_FROM or CAST

Hi all,

I tried the CONVERT_FROM(col, INT_BE), it still doesn't work. I will use
the CAST for the INT conversion.

Thanks all!

George Lu

On Thu, Apr 30, 2015 at 12:10 AM, Jacques Nadeau <ja...@apache.org> wrote:

> Hey George,
>
> This is all dependent on how you store your data in HBase.  Our
> recommendation is to store the data in a binary representation rather than
> a string representation.  It looks like you are currently using the latter
> (string storage).
>
> CONVERT_FROM and CONVERT_TO methods are specifically designed to allow high
> performance transformation between a known binary representation/encoding
> to a Drill's internal format.  'INT' is a 4 byte little endian signed
> integer and 'INT_BE' is a 4 byte big endian signed integer.  Unless you
> store your data differently, you won't be able to use these functions.
>
> On Wed, Apr 29, 2015 at 1:52 AM, George Lu <lu...@gmail.com> wrote:
>
> > Hi all,
> >
> > Not sure whether I can ask questions to this group, if not, kindly ignore
> > this email and thanks for the time.
> >
> > I query HBase from Drill.
> > In the HBase table, I have a column family called log and a column log:ra
> > for some money amount.
> >
> > I want to convert the HBase binary data into INT for the column and I
> use:
> >
> > select convert_from(activities_perf.log.ra, 'INT') FROM activities_perf;
> > However, error says "Query failed: RemoteRpcException: Failure while
> > running fragment., Wrong length 2(2-0) in the buffer '74', expected 4. [
> > 77ba1d80-da84-443f-bb7d-5e0c8f86f68f on local104:31010 ]", what is that?
> >
> > I can query the data by "select SUM(CAST(activities_perf.log.ra AS INT))
> > FROM activities_perf;"
> >
> > Thanks!
> >
> > Regards,
> > George Lu
> >
>