You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Charles Givre <cg...@gmail.com> on 2017/09/06 14:45:45 UTC

Hex in Drill

All,
I'm working on a format plugin in which the data contains a lot of
hexadecimal numbers.  I didn't see it in the docs, but does Drill have any
hex/dec/octal etc conversion functions?

Also, I realize this depends on the length of the integer, (most are
unsigned 4 or 8 bit ints), but what would be be best way to store these
fields in Drill?  I'm currently using the BigIntHolder() for that.  Is that
the best way?

I hope this makes sense.
-- C

Re: Hex in Drill

Posted by Chunhui Shi <cs...@mapr.com>.
Have you tried VarBinary? For data type conversion, you may want to refer to this page: https://drill.apache.org/docs/data-type-conversion/, try these two pairs of functions, also I believe

  *
CONVERT_TO and CONVERT_FROM<https://drill.apache.org/docs/data-type-conversion/#convert_to-and-convert_from>
  *   STRING_BINARY<https://drill.apache.org/docs/data-type-conversion/#string_binary-function> and BINARY_STRING<https://drill.apache.org/docs/data-type-conversion/#binary_string-function>

Also you may want to try 'hex' or 'unhex', which is from Hive(written in Hive libraries), and Drill loads functions from Hive as well but may not test them thoroughly, so explore them to see if you can use them.
________________________________
From: Charles Givre <cg...@gmail.com>
Sent: Wednesday, September 6, 2017 7:45:45 AM
To: dev
Subject: Hex in Drill

All,
I'm working on a format plugin in which the data contains a lot of
hexadecimal numbers.  I didn't see it in the docs, but does Drill have any
hex/dec/octal etc conversion functions?

Also, I realize this depends on the length of the integer, (most are
unsigned 4 or 8 bit ints), but what would be be best way to store these
fields in Drill?  I'm currently using the BigIntHolder() for that.  Is that
the best way?

I hope this makes sense.
-- C