Hive Unable to insert values to an array column using insert

0 votes

Unable to append data to tables that contain an array column using insert into statements; 

the data type is array < varchar(200) >

With the help of JDBC, I am unable to insert values into an array column by values like :

INSERT INTO example.table (codes) VALUES (['m','n']);

does not recognise the "[" or "{" signs.

Using the array function like ...

INSERT INTO demo.table (codes) VALUES (array('m','n'));

I get the following error using array function:

Unable to create temp file for insert values Expression of type TOK_FUNCTION not supported in insert/values

Tried the workaround...

INSERT into demo.table (codes) select array('m','n');

unsuccessfully:

Failed to recognize predicate '<EOF>'. Failed rule: 'regularBody' in statement

How can I load array data into columns using jdbc?

Dec 1, 2018 in Big Data Hadoop by slayer
• 29,370 points
8,435 views

1 answer to this question.

0 votes

make a dummy table which has at least one row.

INSERT INTO example.table (codes) VALUES (array('m','n')) from dummy limit 1;

hive> select codes example.table;
OK
["m","n"]
Time taken: 0.088 seconds, Fetched: 1 row(s)
answered Dec 1, 2018 by Omkar
• 69,230 points
hql execution error, do you mean have data in the dummy table?
Can you explain your query a little bit more?

Related Questions In Big Data Hadoop

+1 vote
1 answer

Hive: How to use insert query like SQL

It is now possible to insert like ...READ MORE

answered Nov 5, 2018 in Big Data Hadoop by Omkar
• 69,230 points
840 views
0 votes
1 answer

Hadoop Hive: How to insert data in Hive table?

First, copy data into HDFS. Then create ...READ MORE

answered Nov 12, 2018 in Big Data Hadoop by Omkar
• 69,230 points
9,737 views
0 votes
1 answer

Hadoop Hive: message:Version information not found in metastore. Unable to instantiate

These are the necessary tables required for metastore that are ...READ MORE

answered Nov 12, 2018 in Big Data Hadoop by Omkar
• 69,230 points
3,495 views
0 votes
1 answer

Hadoop Hive: How to convert multiple rows into comma separated values?

You can use the aggregator function collect_set to do ...READ MORE

answered Nov 14, 2018 in Big Data Hadoop by Omkar
• 69,230 points
5,344 views
0 votes
1 answer

Error while connecting to Hive using Java JDBC

Use ​org.apache.hive.jdbc.HiveDriver as your driver ...READ MORE

answered Nov 22, 2018 in Big Data Hadoop by Omkar
• 69,230 points
1,757 views
0 votes
1 answer

Hive JDBC driver URL format and driver class.

For Hive server 1, the URL format ...READ MORE

answered May 31, 2019 in Big Data Hadoop by Adi
1,986 views
0 votes
1 answer

Moving files in Hadoop using the Java API?

I would recommend you to use FileSystem.rename(). ...READ MORE

answered Apr 15, 2018 in Big Data Hadoop by Shubham
• 13,490 points
2,633 views
0 votes
1 answer

Hadoop giving java.io.IOException, in mkdir Java code.

I am not sure about the issue. ...READ MORE

answered May 3, 2018 in Big Data Hadoop by Shubham
• 13,490 points
2,501 views
0 votes
1 answer

Hadoop Hive Hbase: How to insert data into Hbase using Hive (JSON file)?

You can use the get_json_object function to parse the ...READ MORE

answered Nov 15, 2018 in Big Data Hadoop by Omkar
• 69,230 points
2,887 views
0 votes
1 answer

Hadoop: How to keep duplicates in Hive using collect_set()?

SELECT hash_id, COLLECT_LIST(num_of_cats) AS ...READ MORE

answered Nov 2, 2018 in Big Data Hadoop by Omkar
• 69,230 points
2,423 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP