Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Hive Insert into table issue

avatar
Visitor

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
Visitor
@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
Visitor

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