首页 > 解决方案 > 无法让 Hive SerDe 工作 - 返回 0 条记录

问题描述

这是我第二次尝试使用 SerDe。第一个工作安静,但现在,我真的很挣扎。

我得到了这种结构的 XML: XML 结构

这是我创建的 Hive 表

CREATE TABLE  raw_abc.text_abc
  (
   publicationid string,
   parentid string,
   id string,
   level string,
   usertypeid string,
   name string,
   assetcrossreferences_ordered string,
   assetcrossreferences MAP<string, string>,
   attributenames_ordered string,
   attributenames map<string,string>,
   seo_ordered  string, 
   seo MAP<string, string>
)

ROW FORMAT SERDE 'com.ibm.spss.hive.serde2.xml.XmlSerDe'
WITH SERDEPROPERTIES (
"column.xpath.publicationid"="/ST:ECC-HierarchyMessage/@PublicationID",
"column.xpath.parentid"="/ST:ECC-HierarchyMessage/Product/@ParentID",
"column.xpath.id"="/ST:ECC-HierarchyMessage/Product/@ID",
"column.xpath.level"="/ST:ECC-HierarchyMessage/Product/@Level",
"column.xpath.usertypeid"="/ST:ECC-HierarchyMessage/Product/@UserTypeID",
"column.xpath.name"="/ST:ECC-HierarchyMessage/Product/@Name",
"column.xpath.assetcrossreferences_ordered"="/ST:ECC-HierarchyMessage/Product/AssetCrossReferences/@Ordered",
"column.xpath.assetcrossreferences"="/ST:ECC-HierarchyMessage/Product/AssetCrossReferences/AssetCrossReference",
"column.xpath.attributenames_ordered"="/ST:ECC-HierarchyMessage/Product/AttributeNames/@Ordered",
"column.xpath.attributenames"="/ST:ECC-HierarchyMessage/Product/AttributeNames/@Ordered",
"column.xpath.seo_ordered"="/ST:ECC-HierarchyMessage/Product/SEO/@Ordered",
"column.xpath.seo"="/ST:ECC-HierarchyMessage/Product/SEO"

)
STORED AS
INPUTFORMAT 'com.ibm.spss.hive.serde2.xml.XmlInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
location 's3a://ec-abc-dev/inbound/abc/abc/'
TBLPROPERTIES (
"xmlinput.start"="<ST:ECC-HierarchyMessage>",
"xmlinput.end"="</ST:ECC-HierarchyMessage>"
)
;

表已成功创建,但是,当我尝试 select * from raw_abc.text_abc 时,我没有得到任何记录作为回报。知道这里有什么问题吗?我花了最后 2 天试图弄清楚它没有运气。

谢谢,G

标签: hivehiveqlhive-serde

解决方案


推荐阅读