I have used the _BE types with HBase for example
create or replace view tradesview as select convert_from(row_key, 'UTF8')
 as rowkey, convert_from(t.CF1.price , '*BIGINT_BE*') as price,
convert_from(t.CF1.vol , '*BIGINT_BE*') as vol from maprdb.trades_tall t

TINYINT_BEbytes(1)TINYINTTINYINTbytes(1)TINYINTSMALLINT_BEbytes(2)SMALLINT
SMALLINTbytes(2)SMALLINTINT_BEbytes(4)INTINTbytes(4)INTBIGINT_BEbytes(8)
BIGINT

On Wed, Apr 29, 2015 at 9:44 AM, Kristine Hahn <[email protected]> wrote:

> Please see the preliminary 1.0 docs for this topic:
>
>    - CONVERT_TO/FROM Data Types
>    <
> http://tshiran.github.io/drill/docs/supported-data-types/#convert_to-and-convert_from-data-types
> >
>    - Usage Notes
>    <
> http://tshiran.github.io/drill/docs/data-type-conversion/#convert_to-and-convert_from-usage-notes
> >
>    :
>
> Use CONVERT_TO and CONVERT_FROM instead of the CAST function for converting
> > binary data types with one exception: When converting an INT or BIGINT
> > number, having a byte count in the destination/source that does not match
> > the byte count of the number in the VARBINARY source/destination, use
> CAST.
>
> I think the *_BE types are intended to cope with the byte count mismatch
> problem, but am not sure about that, so for now, CAST is your best bet.
>
> Kristine Hahn
> Sr. Technical Writer
> 415-497-8107 @krishahn
>
>
> On Wed, Apr 29, 2015 at 1:52 AM, George Lu <[email protected]> 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
> >
>

Reply via email to