Hive 向数组复杂类型列插入值 [英] Hive inserting values to an array complex type column
问题描述
我无法使用 insert into 语句将数据附加到包含数组列的表中;数据类型是数组 <varchar(200) >
I am unable to append data to tables that contain an array column using insert into statements; the data type is array < varchar(200) >
使用 jodbc 我无法通过如下值将值插入到数组列中:
Using jodbc I am unable to insert values into an array column by values like :
INSERT INTO demo.table (codes) VALUES (['a','b']);
无法识别["或{"符号.
does not recognises the "[" or "{" signs.
使用数组函数如...
INSERT INTO demo.table (codes) VALUES (array('a','b'));
使用数组函数时出现以下错误:
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
尝试了解决方法...
INSERT into demo.table (codes) select array('a','b');
失败:
Failed to recognize predicate '<EOF>'. Failed rule: 'regularBody' in statement
如何使用 jdbc 将数组数据加载到列中?
How can I load array data into columns using jdbc ?
推荐答案
My Table 有两列:a STRING, b ARRAY
.
My Table has two columns: a STRING, b ARRAY<STRING>
.
当我使用@Kishore Kumar Suthar 的方法时,我得到了这个:
When I use @Kishore Kumar Suthar's method, I got this:
FAILED: ParseException line 1:33 无法识别'(' 'a' ',' 语句中的输入
但我找到了另一种方法,它对我有用:
INSERT INTO test.table
SELECT "test1", ARRAY("123", "456", "789")
FROM dummy LIMIT 1;
dummy
是任何至少有一行的表.
dummy
is any table which has atleast one row.
这篇关于Hive 向数组复杂类型列插入值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!