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?

Nov 30, 2018 in Big Data Hadoop by slayer
• 29,050 points
916 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 Nov 30, 2018 by Omkar
• 67,460 points

Related Questions In Big Data Hadoop

0 votes
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
• 67,460 points
57 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
• 67,460 points
602 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
• 67,460 points
291 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
• 67,460 points
567 views
0 votes
1 answer

Error while connecting to Hive using Java JDBC

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

answered Nov 21, 2018 in Big Data Hadoop by Omkar
• 67,460 points
87 views
0 votes
1 answer
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,290 points
797 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,290 points
399 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
• 67,460 points
529 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
• 67,460 points
245 views