我有以下输入csv文件
10418872, fever, FALSE
10418872, shortness of breath, FALSE
10418872, shortness of breath, FALSE
10418872, shortness of breath, FALSE
我使用这些命令创建了一个hive表,并在其中加载了数据
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;
但是现在我在hive中查询数据
10418872 fever NULL
10418872 shortness of breath NULL
10418872 shortness of breath NULL
10418872 shortness of breath NULL
为什么布尔列变为空?我也试过改变案例。
答案 0 :(得分:1)
请在FALSE之前修剪前方空格并尝试。
我用以上输入测试如下,你可以看到输出的差异:
10418872, fever,FALSE
10418872, shortness of breath,FALSE
10418872, shortness of breath, FALSE
10418872, shortness of breath, FALSE
我在hive中得到了结果:
adverse.patientid adverse.symptom adverse.severe
10418872 fever false
10418872 shortness of breath false
10418872 shortness of breath NULL
10418872 shortness of breath NULL