将数据从.csv文件加载到配置单元表

时间:2018-10-04 04:47:34

标签: hadoop hive

我创建了一个配置单元表,并希望将csv数据加载到其中。数据在单元格中具有多个换行符,因此它返回不需要的结果。

如何在配置单元表中处理多个换行符?

我尝试过这种代码:

This format is used

This is whole one row data

this is the result I get from the query

但是预期结果只是日期。

CREATE EXTERNAL TABLE db_raw.schoolData
(
     Date string, 
     height string,
     weight string,
     ready_to_make string
)

ROW FORMAT serde 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
with serdeproperties (
    "separatorChar" = ",",
    "quoteChar"     = "\""

)     
STORED AS TEXTFILE
LOCATION 'bucket path'
tblproperties('skip.header.line.count'='1');

获取此类数据作为来自

的输出
Select Date from schoolData

输出:

May 15, 2018                                       |
|  '21232514346020300                                |
|  '21232514346020300 '21232514346020300,OD212325143460203000,62029200,

预期结果:

May 15, 2018

Referred to this link also but it didn't help

同类问题

0 个答案:

没有答案