我hivexmlserde-1.0.5.3
用来将 XML 数据解析为 Hive 表。当我尝试解析其中有换行符的标签时,我遇到了一个问题,如下所示:
<item>
<itemid>1</itemid>
<contents subscript = "n">
<name>Item1</name>
<details>Line 1 with a line break.
Line 2 here, which is not being read.</details>
</contents>
</item>
当我尝试使用以下内容解析它时,这只是读取第一行:
DROP TABLE IF EXISTS db.tbl;
CREATE EXTERNAL TABLE db.tbl (
ID STRING COMMENT '',
CONTENTS ARRAY<STRUCT<
subscript:STRING,
contents:struct<Name:STRING,Details:STRING>>> COMMENT '') COMMENT ''
ROW FORMAT SERDE 'com.ibm.spss.hive.serde2.xml.XmlSerDe'
WITH SERDEPROPERTIES (
"column.xpath.OB_CASE_ID"="/item/itemID/text()",
"column.xpath.HISTORICAL_INTERACTION"= "/item/contents")
STORED AS
INPUTFORMAT 'com.ibm.spss.hive.serde2.xml.XmlInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION '${stagingFolderPath}'
TBLPROPERTIES ("xmlinput.start"="<item>","xmlinput.end"="</item>");
我做错了什么还是有更好的方法来做到这一点?任何帮助将不胜感激。
TIA