我是樱桃。我想将 csv
加载到表中。
add jar /home/hadoop/csv-serde.jar;
create database IF NOT EXISTS test;
use test;
CREATE TABLE IF NOT EXISTS test.neighbors(
objID bigint ,
NeighborObjID bigint ,
distance float ,
type smallint ,
neighborType smallint ,
mode tinyint ,
neighborMode tinyint) row format serde 'com.bizo.hive.serde.csv.CSVSerde';
但是描述邻居:
objid string from deserializer
neighborobjid string from deserializer
distance string from deserializer
type string from deserializer
neighbortype string from deserializer
mode string from deserializer
neighbormode string from deserializer
所有属性都变成“来自反序列化器的字符串”,而不是 int 或 float。
objID bigint ,
NeighborObjID bigint ,
distance float ,
type smallint ,
neighborType smallint ,
mode tinyint ,
neighborMode tinyint
这就是我想要的。我想将 csv
加载到邻居。
最佳答案
使用
ROW FORMAT DELIMITED 以','结尾的字段 存储为文本文件;
代替
行格式 serde 'com.bizo.hive.serde.csv.CSVSerde'
关于csv - 类型错误 : string from deserializer instead of int when load csv to table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30657983/