Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to load data into Hive Complex Data type (ARRAY)..?

How to load data into Hive Complex Data type (ARRAY)..?

New Contributor

Hi,

I want to load data into complex data type ARRAY<STRING> from another tables, Here my table schema is

query.txt

in that table2 and table3 are separate tables and rest of the schema from table,

Please let me know how to populate this table from these 3 tables,

Thanks in advance

2 REPLIES 2
Highlighted

Re: How to load data into Hive Complex Data type (ARRAY)..?

Expert Contributor

Hi,

Please go through once below example. Hope it will be useful.

cat >mapfile

1,abc,40000,a$b$c,pf#500$epf#200,hyd$ap$500001

2,def,3000,d$f,pf#500,bang$kar$600038

hive> create table tab11(id int,name string,sal bigint,sub array<string>,dud map<string,int>,addr struct<city:string,state:string,pin:bigint>)

> row format delimited

> fields terminated by ','

> collection items terminated by '$'

> map keys terminated by '#';

hive> load data local inpath '/home/training/structfile' into table tab11;

Re: How to load data into Hive Complex Data type (ARRAY)..?

New Contributor

Hi Mahesh,

in my case i have to take data from 3 different files, u have any idea..?

Thanks,

Anji

Don't have an account?
Coming from Hortonworks? Activate your account here