I create an external table with HIVE (Hive 2.1.1-mapr-1703) from an XML file with XML SerDe. The file is the XML example from the W3C consortium.
This is my code to create the table:
add jar /mapr/localpath/hivexmlserde-1.0.5.3.jar;
USE my_db;
CREATE EXTERNAL TABLE frank_books (
category STRING,
title STRING,
language STRING,
year BIGINT
)
ROW FORMAT SERDE 'com.ibm.spss.hive.serde2.xml.XmlSerDe'
WITH SERDEPROPERTIES (
"column.xpath.category" = "/book/@category",
"column.xpath.title" = "/book/title/text()",
"column.xpath.language" = "/book/title/@lang",
"column.xpath.year" = "/book/year/text()"
)
STORED AS
INPUTFORMAT 'com.ibm.spss.hive.serde2.xml.XmlInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
LOCATION '/mapr/localpath/database_files/xml_example'
TBLPROPERTIES (
"xmlinput.start" = "<book category",
"xmlinput.stop" = "</book>"
)
The table itself exists because the describe statement does not lead to an error:
describe frank_books;
A simple select statement like the following leads to a NullPointerException:
select * from my_db.frank_books;
This is the output:
OK
Failed with exception java.io.IOException:java.lang.NullPointerException
Time taken: 1.117 seconds
Can anyone help and please explain the error to me?
Thanks, Frank