我有以下输入 csv 文件
10418872, fever, FALSE
10418872, shortness of breath, FALSE
10418872, shortness of breath, FALSE
10418872, shortness of breath, FALSE
我使用这些命令创建了一个配置单元表并在其中加载了数据
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
为什么 bool 列变为空?我也尝试过更改大小写。
最佳答案
请在 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
关于hive - Hive 中的 bool 列加载为 NULL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29376193/