0
votes

I have created a hive table stored with Avro file format. I am trying to load same hive table using below Pig commands

pig -useHCatalog;
hive_avro = LOAD 'hive_avro_table' using org.apache.hive.hcatalog.pig.HCatLoader();

I am getting " failed to read from hive_avro_table " error when I tried to display "hive_avro" using DUMP command.

Please help me how to resolve this issue. Thanks in advance

1

1 Answers

0
votes
create table hivecomplex
(name string,
phones array<INT>,
deductions map<string,float>,
address struct<street:string,zip:INT>
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
COLLECTION ITEMS TERMINATED BY '$'
MAP KEYS TERMINATED BY '#'
STORED AS AVRO
;

hive> select * from hivecomplex;
OK
John    [650,999,9999]  {"pf":500.0}    {"street":"pleasantville","zip":88888}
Time taken: 0.078 seconds, Fetched: 1 row(s)

Now for the pig

pig -useHCatalog;

a = LOAD 'hivecomplex' USING org.apache.hive.hcatalog.pig.HCatLoader();
dump a;

ne.util.MapRedUtil - Total input paths to process : 1
(John,{(650),(999),(9999)},[pf#500.0],(pleasantville,88888))