1
jan 18 "value1 is null"
feb  4 "value1 is null"

在上面的数据集中,第二行的第 1 列和第 2 列之间有连续的分隔符,如何将连续的分隔符作为一个分隔符处理。

4

1 回答 1

0
create external table mydata 
(
    c1 string
   ,c2 string
   ,c3 string
)
row format serde 'org.apache.hadoop.hive.serde2.RegexSerDe'
with serdeproperties ('input.regex' = '(".*?"|.*?)\\s+(".*?"|.*?)\\s+(".*?"|.*?)')
location '/user/hive/warehouse/mydata'
;

select * from mydata;

+-----------+-----------+------------------+
| mydata.c1 | mydata.c2 |    mydata.c3     |
+-----------+-----------+------------------+
| jan       |        18 | "value1 is null" |
| feb       |         4 | "value1 is null" |
+-----------+-----------+------------------+
于 2017-02-22T10:55:58.770 回答