Hive load CSV with commas in quoted fields

前端 未结 6 923
长情又很酷
长情又很酷 2020-12-23 02:44

I am trying to load a CSV file into a Hive table like so:

CREATE TABLE mytable
(
num1 INT,
text1 STRING,
num2 INT,
text2 STRING
)
ROW FORMAT DELIMITED FIELDS         


        
6条回答
  •  青春惊慌失措
    2020-12-23 03:04

    If you can re-create or parse your input data, you can specify an escape character for the CREATE TABLE:

    ROW FORMAT DELIMITED FIELDS TERMINATED BY "," ESCAPED BY '\\';
    

    Will accept this line as 4 fields

    1,some text\, with comma in it,123,more text
    

提交回复
热议问题