Created 03-10-2016 03:15 AM
I am trying to load the data into Array data type in hive and got below errors .
1 ) INSERT INTO table test_array VALUES (1,array('a','b'));
Error: Error while compiling statement: FAILED: SemanticException [Error 10293]: Unable to create temp file for insert values Expression of type TOK_FUNCTION not supported in insert/values (state=42000,code=10293)
2 ) INSERT INTO test_array (col2) VALUES (array('a','b')) from dummy limit 1;
Error: Error while compiling statement: FAILED: ParseException line 1:54 missing EOF at 'from' near ')' (state=42000,code=40000)
Created 03-10-2016 12:43 PM
@Nelson KA Rajendran You need to create a dummy table with one row
create table dummy(a string); insert into table dummy values ('a');
Then you can insert to your test_array table using
INSERT INTO table test_array SELECT 1, array('a','b') from dummy;
You can't insert a complex type directly to Hive table.
Created 03-10-2016 12:43 PM
@Nelson KA Rajendran You need to create a dummy table with one row
create table dummy(a string); insert into table dummy values ('a');
Then you can insert to your test_array table using
INSERT INTO table test_array SELECT 1, array('a','b') from dummy;
You can't insert a complex type directly to Hive table.
Created 05-30-2017 03:05 PM
If you don't already have a table with at least one row, you can accomplish the desired result without creating a dummy table.
insert into test_array select 1, array('a','b') from (select '123') x;
Created 07-11-2017 10:26 PM
If you are using Hive 2 or later (including Hive LLAP), you no longer need the dummy table, statements like:
INSERT INTO table test_array SELECT 1, array('a','b');
will work.