gpt4 book ai didi

hadoop - Hive 将值插入数组复杂类型列

转载 作者:可可西里 更新时间:2023-11-01 14:13:51 32 4
gpt4 key购买 nike

我无法使用 insert into 语句将数据附加到包含数组列的表中;数据类型为数组 < varchar(200) >

使用 jodbc,我无法通过以下值将值插入到数组列中:

INSERT INTO demo.table (codes) VALUES (['a','b']);

不识别“[”或“{”符号。

像...一样使用数组函数

INSERT INTO demo.table (codes) VALUES (array('a','b'));

我在使用数组函数时遇到以下错误:

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 将数组数据加载到列中?

最佳答案

我的表有两列: a STRING, b ARRAY<STRING>

当我使用@Kishore Kumar Suthar 的方法时,我得到了这个:

FAILED: ParseException line 1:33 cannot recognize input near '(' 'a' ',' in statement

但我找到了另一种方法,它对我有用:

INSERT INTO test.table 
SELECT "test1", ARRAY("123", "456", "789")
FROM dummy LIMIT 1;

dummy 是至少有一行的任何表格。

关于hadoop - Hive 将值插入数组复杂类型列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30446601/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com