Hive Boolean columns load as NULL

I have the following csv input file

10418872, fever, FALSE
10418872, shortness of breath, FALSE
10418872, shortness of breath, FALSE
10418872, shortness of breath, FALSE

I created a hive table using these commands and the data loaded into it

create database bpo;
CREATE EXTERNAL TABLE bpo.adverse(patientId INT, symptom STRING, severe BOOLEAN) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STORED AS TEXTFILE LOCATION '/landingzone/hive/adverse';
LOAD DATA INPATH '/landingzone/adverse-effects.csv' INTO TABLE bpo.adverse;

However, now when I request data in the hive

10418872         fever  NULL
10418872         shortness of breath    NULL
10418872         shortness of breath    NULL
10418872         shortness of breath    NULL

why did boolean columns become null? I also tried changing case.

+4
source share
1 answer

Please trim the leading space before FALSE and try.

I tested with the above input as follows, you can see the difference in output:

10418872, fever,FALSE
10418872, shortness of breath,FALSE
10418872, shortness of breath, FALSE
10418872, shortness of breath, FALSE

I got the result in the bush as:

adverse.patientid  adverse.symptom  adverse.severe
10418872         fever  false
10418872         shortness of breath    false
10418872         shortness of breath    NULL
10418872         shortness of breath    NULL
+1
source

All Articles