I am trying to extract the timestamp from an xml using xml serde in Hive. The external table creation links to a hdfs directory. Currently, the timestamp value shows up as null in my table.
I am thinking the timestamp needs to be casted? I am not sure. The rest of the xml information is working correctly and shows up in hive.
Input file is:
<example>
<date>2017-02-09 22:03:58<date>
</example>
Hive Creation Script:
create external table example (
date timestamp
)
ROW FORMAT SERDE 'com.ibm.spss.hive.serde2.xml.XmlSerDe'
WITH SERDEPROPERTIES (
"column.xpath.date"="/example/date/text()"
)
STORED AS
INPUTFORMAT 'com.ibm.spss.hive.serde2.xml.XmlInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
LOCATION 'mypath'
TBLPROPERTIES (
"xmlinput.start"="<example>",
"xmlinput.end"="</example>"
);