首页 > 解决方案 > 无论如何将逗号分隔的字符串加载到配置单元中的单个列中?

问题描述

“插入/值不支持 TOK_STRINGLITERALSEQUENCE”在将数据加载到配置单元时出现此错误。

当尝试将逗号分隔的字符串插入单个列时,它显示错误为

'插入/值不支持 TOK_STRINGLITERALSEQUENCE'

insert into table table_name values('llu'/t'ghf'/t'a,b,c,d'/t'gh,edf,ghu,kjhl'/t'1') 

/t 表示分隔符为制表符

加载数据时出现错误,因为“插入/值不支持 TOK_STRINGLITERALSEQUENCE”。

Expected results
col1     col2      col3        col4               col5
llu      ghf       a,b,c,d     gh,edf,ghu,kjhl    1

标签: hiveql

解决方案


我不确定您为什么对插入语句使用制表符分隔。这在 Hive 版本 1.2.1 中对我有用

create table test (col1 STRING, col2 STRING, col3 STRING, col4 STRING, col5 STRING);

insert into table test values('llu','ghf','a,b,c,d','gh,edf,ghu,kjhl','1');

select * from test;
+------------+------------+------------+------------------+------------+--+
| test.col1  | test.col2  | test.col3  |    test.col4     | test.col5  |
+------------+------------+------------+------------------+------------+--+
| llu        | ghf        | a,b,c,d    | gh,edf,ghu,kjhl  | 1          |
+------------+------------+------------+------------------+------------+--+

推荐阅读