如何忽略csv Hive表中的单双引号,如Hello“World”

时间:2018-03-29 05:09:15

标签: csv apache-spark hadoop hive

我使用escapeChar='\"'的serde类,但值存储为 NULL而不是Hello World /

>> cat file.csv 1, Hello"World

>> table ddl

create table test (id int, name string) ROW FORMAT SERDE              
| |   'org.apache.hadoop.hive.serde2.OpenCSVSerde'     | | WITH
SERDEPROPERTIES (                             | |  
'separatorChar'=','
    'escapeChar'='\"'
    'quoteChar'='\"')                             | | STORED AS INPUTFORMAT                              | |  
'org.apache.hadoop.mapred.TextInputFormat'       | | OUTPUTFORMAT     
| |   'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' |

>> Output:
Hive: Select * from test; 
ok 
1, NULL

????

0 个答案:

没有答案