无法使Hive SerDe正常工作-返回0条记录

时间:2019-02-11 12:33:28

标签: hive hiveql hive-serde

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

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

这是我创建的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>"
)
;

表创建成功,但是, 当我尝试从raw_abc.text_abc选择*时,我没有得到任何记录。 知道这里有什么问题吗?我花了最后两天的时间来尝试解决这个问题。

谢谢, G

0 个答案:

没有答案