在hue-hive界面中使用文件创建表格时,我们必须指定分隔符。(制表符、空格、逗号等)。但我的文件由一个或多个空格分隔。如何指定分隔符以由一个或多个空格分隔。

发布于 2015-12-30 13:32:14
您可以通过以下方式使用regex作为分隔符来创建表:
data ,将数据放入hdfs
1 2 3 4
a b c d创建表:
//grammar for create table
CREATE TABLE test1(
a string,
b string,
c string,
d string
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' WITH SERDEPROPERTIES
(
"input.regex" ="([^\\s]*)\\s+([^\\s]*)\\s+([^\\s]*)\\s+([^\\s]*)",
"output.format.string" = "%1$s %2$s %3$s %4$s"
)
LOCATION '/test1/';https://stackoverflow.com/questions/34507710
复制相似问题