Search code examples
hiveapache-hive

What is the limit of BINARY data types in Hive 1.2?


I did not find much about BINARY data types in apache docs: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types

I created a table with BINARY column using-

create table table1(col1 binary);

After fetching metadata via JDBC I found,

columnSize:2147483647

Is there any official document for this?


Solution

  • From the Binary DataType Proposal :

    How is 'binary' represented internally in Hive

    Binary type in Hive will map to 'binary' data type in thrift.

    Primitive java object for 'binary' type is ByteArrayRef

    PrimitiveWritableObject for 'binary' type is BytesWritable

    And since ByteArrayRef holds a reference to a byte array, the answer should be Integer.MAX_VALUE - 5, see here