BOOLEAN Data Type
A data type used in CREATE TABLE and ALTER TABLE statements, representing a single true/false choice.
Range: TRUE or FALSE. Do not use quotation marks around the TRUE and FALSE literal values. You can write the literal values in uppercase, lowercase, or mixed case. The values queried from a table are always returned in lowercase, true or false.
Conversions: Impala does not automatically convert any other type to BOOLEAN. You can use CAST() to convert any integer or float-point type to BOOLEAN: a value of 0 represents false, and any non-zero value is converted to true. You cannot cast a STRING value to BOOLEAN, although you can cast a BOOLEAN value to STRING, returning '1' for true values and '0' for false values.
Partitioning:
Do not use a BOOLEAN column as a partition key. Although you can create such a table, subsequent operations produce errors:
[localhost:21000] > create table truth_table (assertion string) partitioned by (truth boolean); [localhost:21000] > insert into truth_table values ('Pigs can fly',false); ERROR: AnalysisException: INSERT into table with BOOLEAN partition column (truth) is not supported: partitioning.truth_table
Related information: Literals, Conditional Functions
<< BIGINT Data Type | DECIMAL Data Type (CDH 5.1 or higher only) >> | |