如何在配置单元中加载分隔符输入文件的组合类型?输入文件将具有“”和xml的组合…如何加载和处理数据例如输入数据是- "hi"|"welcome"|"to"|India|<xml>data</xml> 如果我们面临这样的问题,该如何处理?提前感谢您的任何想法或例子请。我需要加载hi | welcome | to | india |数据,这里如何在将数据加载到hive时附加xml数据?
"hi"|"welcome"|"to"|India|<xml>data</xml>
j91ykkif1#
正则表达式
create external table mytable (c1 string,c2 string,c3 string,c4 string,c5 string) row format serde 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' with serdeproperties ( 'input.regex' = '(".*?"|[^|]*)\\|(".*?"|[^|]*)\\|(".*?"|[^|]*)\\|(".*?"|[^|]*)\\|(.*)' ) ;
select * from mytable ;
+------+-----------+------+-------+-----------------+ | c1 | c2 | c3 | c4 | c5 | +------+-----------+------+-------+-----------------+ | "hi" | "welcome" | "to" | India | <xml>data</xml> | +------+-----------+------+-------+-----------------+
1条答案
按热度按时间j91ykkif1#
正则表达式