我可以在创建 table 时在配置单元中一次使用 2 个字段终止符(如 ',' 和 '.')吗?
Can I use 2 fields terminators(like ',' and '.') at a time in hive while creating table?
我有一个包含 id
和 year
的文件。我的字段由 ,
和 .
分隔。有没有可能我可以使用 ,
和 .
来代替终止的字段?
这可以使用 RegexSerDe。
hive> CREATE EXTERNAL TABLE citiesr1 (id int, city_org string, ppl float)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'
WITH SERDEPROPERTIES ('input.regex'='^(\d+)\.(\S+),(\d++.\d++)\t.*')
LOCATION '/user/it1/hive/serde/regex';
在上面的正则表达式中定义了三个正则表达式组。
(\d+) leading digits is the int id column
dot . is a separator
(\S+) - string without spaces is the city_org string column
comma , is a separator
(\d++.\d++) - float column
\t - tab separator
我有一个包含 id
和 year
的文件。我的字段由 ,
和 .
分隔。有没有可能我可以使用 ,
和 .
来代替终止的字段?
这可以使用 RegexSerDe。
hive> CREATE EXTERNAL TABLE citiesr1 (id int, city_org string, ppl float)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'
WITH SERDEPROPERTIES ('input.regex'='^(\d+)\.(\S+),(\d++.\d++)\t.*')
LOCATION '/user/it1/hive/serde/regex';
在上面的正则表达式中定义了三个正则表达式组。
(\d+) leading digits is the int id column
dot . is a separator
(\S+) - string without spaces is the city_org string column
comma , is a separator
(\d++.\d++) - float column
\t - tab separator