Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Error 10293 while inserting a row to a hive table having array as one of the fileds

Tags:

hive

I have a hive table created using the following query:

create table arraytbl (id string, model string, cost int, colors array <string>,size array <float>)
row format delimited fields terminated by ',' collection items terminated by '#';

Now , while trying to insert a row:

insert into mobilephones values 
("AA","AAA",5600,colors("red","blue","green"),size(5.6,4.3));

I get the following error:

FAILED: SemanticException [Error 10293]: Unable to create temp file for insert values Expression of type TOK_FUNCTION not supported in insert/values

How can I resolve this issue?

like image 782
Jagdish Avatar asked Sep 15 '25 19:09

Jagdish


1 Answers

The syantax to enter values in complex datatype if kinda bit weird, however this is my personal opinion.

You need a dummy table to insert values into hive table with complex datatype.

insert into arraytbl select "AA","AAA",5600, array("red","blue","green"), array(CAST(5.6 AS FLOAT),CAST(4.3 AS FLOAT)) from (select 'a') x;

And this is how it looks after insert.

hive> select * from arraytbl;
OK
AA  AAA 5600    ["red","blue","green"]  [5.6,4.3]
like image 141
Gaurang Shah Avatar answered Sep 18 '25 14:09

Gaurang Shah