I created a table temp that has array of struct
create table temp (regionkey smallint, name string, comment string, nations array<struct<n_nationkey:smallint,n_name:string,n_comment:string>>)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '|'
COLLECTION ITEMS TERMINATED BY ',';
Then I loaded the data into the table
LOAD DATA LOCAL INPATH '/Data Sets/region.csv' INTO TABLE temp;
Desired output when did
select * from temp;
is
4 EUROPE Low sale Business Region [{"n_nationkey":22,"n_name":"Ryan","n_comment":"Reference the site"}]
But actual output is
4 EUROPE Low sale Business Region [{"n_nationkey":22,"n_name":null,"n_comment":null},{"n_nationkey":null,"n_name":null,"n_comment":null},{"n_nationkey":null,"n_name":null,"n_comment":null}]
DATA FILE
4|EUROPE|Low sale Business Region for Training4Exam.com|7,Bulgaria,Reference
4|EUROPE|Low sale Business Region for HadoopExam.com|19,Belgium,Reference site
4|EUROPE|Low sale Business Region for Training4Exam.com|22,Ryan,Reference site
This was my first exam with arrays and struct and I am blank on this. Any help with be highly appreciated. Thanks