I have the sample XML file, Sorry for editing the sample xml missed some tags
<?xml version="1.0"?>
<wd:File xmlns:wd="urn:com.workday/bsvc">
<wd:Report_Entry>
<wd:All_Candidate_Job_Profiles wd:Descriptor="Manager I">
<wd:ID wd:type="WID">e83ebdbd2a0a013fcbb5009a49e9d9d4</wd:ID>
<wd:ID wd:type="Job_Profile_ID">US-100017363</wd:ID>
</wd:All_Candidate_Job_Profiles>
<wd:All_Companies_as_Text>Xyz, Inc.</wd:All_Companies_as_Text>
<wd:All_Watched_Companies>0</wd:All_Watched_Companies>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:All_Candidate_Job_Profiles wd:Descriptor="Manager II">
<wd:ID wd:type="WID">e83ebdbd2a0a013fcbb5009a49e9d9d4</wd:ID>
<wd:ID wd:type="Job_Profile_ID">US-100017363</wd:ID>
</wd:All_Candidate_Job_Profiles>
<wd:All_Companies_as_Text>abc, Inc.</wd:All_Companies_as_Text>
<wd:All_Watched_Companies>0</wd:All_Watched_Companies>
</wd:Report_Entry>
</wd:File>
Я пытаюсь загрузить данные, используя следующий запрос:
CREATE external TABLE ww_hr_dl_staging_hiring.recruiting_candidates_serdie(
All_Candidate_Job_Profiles array<string>,
All_Companies_as_Text string,
All_Watched_Companies string
)
ROW FORMAT SERDE 'com.ibm.spss.hive.serde2.xml.XmlSerDe'
WITH SERDEPROPERTIES (
'column.xpath.All_Companies_as_Text'='wd:File/wd:Report_Entry/*
[local-name()=\"wd:All_Companies_as_Text\"]/text()',
'column.xpath.All_Watched_Companies'='wd:File/wd:Report_Entry/*
[local-name()=\"wd:All_Watched_Companies\"]/text()'
)
STORED AS
INPUTFORMAT 'com.ibm.spss.hive.serde2.xml.XmlInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
TBLPROPERTIES (
'xmlinput.start'='<wd:File xmlns',
'xmlinput.end'='</wd:File>'
);
Загрузка данных из hdfs с использованием пути к данным загрузки 'path' в 'tablename'
Up onвыбирая данные из запроса, я получаю нулевые значения
select * from ww_hr_dl_staging_hiring.recruiting_candidates_serdie;
OK NULL NULL
My output should retreive
Manager I Xyz, Inc 0
Manager II abc inc 0