为了处理日志,我想使用Apache Hive regEx serde但我只找到了使用String作为表的列的数据类型的示例.
现在我的问题是:是基于日期的类型,支持整数和数组还是只是字符串?
此示例(和其他)仅使用字符串:
CREATE TABLE access_log (
remote_ip STRING,
request_date STRING,
method STRING,
request STRING,
protocol STRING
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe'
WITH SERDEPROPERTIES (
"input.regex" = "([^ ]) . . [([^]]+)] \"([^ ]) ([^ ]) ([^ \"])\" *",
"output.format.string" = "%1$s %2$s %3$s %4$s %5$s"
)
STORED AS TEXTFILE
Run Code Online (Sandbox Code Playgroud)
;
希望这可以帮助 :)