Using miscellaneous data types
Hive supports two miscellaneous data types: Boolean
and Binary
:
Boolean
accepts true
or false
values.
Binary
is a sequence of bytes. It is similar to the VARBINARY
data type found in many relational databases. If a field is declared as the binary
type, then it is stored within a record, not separately like BLOBs
. The binary
data type is used when a record has hundreds of columns, and the user is just interested in a few columns and doesn't bother about an exact type information of other columns. In such cases, a user can define the type of those columns as binary
, so Hive will not try to interpret those columns. It is used to include the arbitrary
types in record, and Hive doesn't attempt to parse them as numbers, strings, and so on.
How to do it…
The following is the example in order to use the Boolean
data types in Hive:
CREATE TABLE example (id INT, status BOOLEAN, description STRING);
The preceding statement creates a table, example
, with the status as the Boolean...