我有一个.xml文件,其中包含如下数据:
<book>
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price discount="0.15">44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with XML.</description>
</book>
<book>
<author>Knorr, Stefan</author>
<title>Creepy Crawlies</title>
<genre>Horror</genre>
<price discount="0.15">4.95</price>
<publish_date>2000-12-06</publish_date>
<description>An anthology of horror stories about roaches,centipedes, scorpionsand other insects.</description>
</book>
<book>
<author>Galos, Mike</author>
<title>Visual Studio 7: A Comprehensive Guide</title>
<genre>Computer</genre>
<price discount="0.15">49.95</price>
<publish_date>2001-04-16</publish_date>
<description>Microsoft Visual Studio 7 is explored in depth, looking at how Visual Basic, Visual C++, C#, and ASP+ are integrated into a comprehensive development environment.</description>
</book>
我正在尝试通过配置单元来解析xml,方法是使用serde在hdfs上的xml文件上创建外部表。请在下面找到我的代码
我先加了jar
add jar hdfs://xtlinno1vftsnxg:8020/user/hdfs/hivexmlserde-1.0.5.3.jar;
CREATE EXTERNAL TABLE hive_test_xml(
. . . . . . . . . . . . . . . . . . . . . . .> col1 string,
. . . . . . . . . . . . . . . . . . . . . . .> col2 string,
. . . . . . . . . . . . . . . . . . . . . . .> col3 string)
. . . . . . . . . . . . . . . . . . . . . . .> ROW FORMAT SERDE 'com.ibm.spss.hive.serde2.xml.XmlSerDe'
. . . . . . . . . . . . . . . . . . . . . . .> WITH SERDEPROPERTIES (
. . . . . . . . . . . . . . . . . . . . . . .> "column.xpath.col1"="/book/author/text()",
. . . . . . . . . . . . . . . . . . . . . . .> "column.xpath.col2"="/book/title/text()",
. . . . . . . . . . . . . . . . . . . . . . .> "column.xpath.col3"="/book/genre/text()"
. . . . . . . . . . . . . . . . . . . . . . .> )
. . . . . . . . . . . . . . . . . . . . . . .> STORED AS
. . . . . . . . . . . . . . . . . . . . . . .> INPUTFORMAT 'com.ibm.spss.hive.serde2.xml.XmlInputFormat'
. . . . . . . . . . . . . . . . . . . . . . .> OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
. . . . . . . . . . . . . . . . . . . . . . .> LOCATION 'hdfs://xtlinno1vftsnxg:8020/user/poctest2/testxml2.xml'
. . . . . . . . . . . . . . . . . . . . . . .> TBLPROPERTIES (
. . . . . . . . . . . . . . . . . . . . . . .> "xmlinput.start"="<book",
. . . . . . . . . . . . . . . . . . . . . . .> "xmlinput.end"="</book>");
我得到的错误是
执行错误,从org.apache.hadoop.hive.ql.exec.ddltask返回代码1。org/apache/hadoop/hive/serde2/serde(state=08s01,code=1)
我不知道如何解决这个错误…请帮助!!
1条答案
按热度按时间64jmpszr1#
很可能是metastore\u db已损坏。请将验证设置为忽略并修复metastore中的表名。