这是我第二次尝试使用serde。第一个很安静,但现在,我真的很挣扎。
我得到了这种结构的xml:
这是我创建的配置单元表
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\u .text\u 中选择*时,没有得到任何记录。知道这里怎么了吗?我花了两天的时间想弄清楚,但运气不好。
谢谢,g
暂无答案!
目前还没有任何答案,快来回答吧!