Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Hive Insert into table issue

avatar
Contributor

I need to create a table with just a field, which is a map of string: string. I have created the table without problems, but when I try to insert the values (they are defined, not in another table) I am not able to achieve it. The code is below.

create table comunidades ( codigo MAP<STRING, STRING> );
INSERT INTO TABLE comunidades SELECT 1, {"AND": '01'};
1 ACCEPTED SOLUTION

avatar
Master Mentor

@Luis Ruiz

I tried recreating your situation and it worked. see attached.To use the map function the source tables should already exist. I used a text file ruiz.txt with values

$ cat ruiz.txt
"AND": '01'
"TOO": '02'
"MORE": '03'

Hope that helps please accept the reponse if it resolved your problem!

View solution in original post

12 REPLIES 12

avatar
Contributor
@Geoffrey Shelton Okot

The table was filled in the previous actions, but the Ambari platform throws me the specified error above. Now I would need to specify the values into file ruiz.txt as proper key-value pairs, and not inserting null after the file rows. I'll look how to do it. Thank you very much for your patience

avatar
Master Mentor

@Luis Ruiz

Nice to know it helped, that's the open source spirit 🙂

avatar
Contributor

Yes, it's the better way to solve problems 🙂