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

﹥>﹥吖頭↗ 提交于 2021-02-10 05:55:07

问题


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?


回答1:


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]


来源:https://stackoverflow.com/questions/52330141/getting-error-10293-while-inserting-a-row-to-a-hive-table-having-array-as-one-of

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!