【发布时间】:2018-02-13 09:41:47
【问题描述】:
我尝试从保存到 HDFS 的 CSV 文件创建表。问题是 csv 在引号内包含 换行符。 CSV 记录示例:
ID,PR_ID,SUMMARY
2063,1184,"This is problem field because consists line break
This is not new record but it is part of text of third column
"
我创建了配置单元表:
CREATE TEMPORARY EXTERNAL TABLE hive_database.hive_table
(
ID STRING,
PR_ID STRING,
SUMMARY STRING
)
row format serde 'com.bizo.hive.serde.csv.CSVSerde'
with serdeproperties (
"separatorChar" = ",",
"quoteChar" = "\"",
"escapeChar" = "\""
)
stored as textfile
LOCATION '/path/to/hdfs/dir/csv'
tblproperties('skip.header.line.count'='1');
然后我尝试计算行数(正确的结果应该是 1)
Select count(*) from hive_database.hive_table;
但结果是 4 不正确。你知道如何解决它吗?谢谢大家。
【问题讨论】: