我在hdfs文件中有以下5行数据。我想把这个放到table上。我有regex可以做到这一点,但是它为每一行数据加载了一个额外的空行。有人知道为什么会这样吗?
19/Mar/2018 3:00:06 INFO activity Submitted to Splunk
19/Mar/2018 3:00:20 INFO activity response received statuscode=200 bytesreceived=11548264
19/Mar/2018 3:00:21 INFO activity done writing K:\Data\031818\activity_031818.csv lineswritten=296110
19/Mar/2018 3:00:21 INFO hardware Submitted to Splunk
我用这个来创建表
create table Splunk_BCO_MSR
(
ts string,
status string,
area string,
text string
)
partitioned by (partition_dt date)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe'
WITH SERDEPROPERTIES ("input.regex" = "([^ ]+[ ][^ ]*) ([^ ]*) ([^ ]*) (.*)?");
这几乎是可行的,但是当我从表中运行select*时,得到的是8行而不是4行。看起来添加了一行空值。
| 19/Mar/2018 3:00:06 | INFO | activity | Submitted to Splunk | 2018-03-18 |
| NULL | NULL | NULL | NULL | 2018-03-18 |
| 19/Mar/2018 3:00:20 | INFO | activity | response received statuscode=200 bytesreceived=11548264 | 2018-03-18 |
| NULL | NULL | NULL | NULL | 2018-03-18 |
| 19/Mar/2018 3:00:21 | INFO | activity | done writing K:\Data\031818\activity_031818.csv lineswritten=296110 | 2018-03-18 |
| NULL | NULL | NULL | NULL | 2018-03-18 |
| 19/Mar/2018 3:00:21 | INFO | hardware | Submitted to Splunk | 2018-03-18 |
| NULL | NULL | NULL | NULL | 2018-03-18
暂无答案!
目前还没有任何答案,快来回答吧!