我正在尝试将数据插入表中我收到以下错误:
hive>CREATE EXTERNAL TABLE IF NOT EXISTS employee
(
EMP_ID BIGINT,
EMP_DESG STRING,
EMP_ADD ARRAY<STRUCT<DNO: STRING,STATE:STRING,CITY:STRING,ZIPCODE:BIGINT>>
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
stored as textfile;
;
hive>insert overwrite table empmongo
select emp_id, emo_desg, emp_add from employee;
失败:NoMatchingMethodException没有类的匹配方法 org.apache.hadoop.hive.ql.udf.UDFToString with (阵列&GT)。 可能的选择: FUNC (二进制) FUNC (浮点) FUNC (双) FUNC (字符串) FUNC (时间戳) FUNC (十进制) FUNC (bigint) FUNC (void) FUNC (布尔) FUNC (int) FUNC (smallint) FUNC (tinyint)< / p>
你能提供一个建议的解决方案吗?
答案 0 :(得分:-1)
我能够以两种不同的方式将数据插入到您的表中:
insert into table employee2 select * from employee;
工作正常:
此外:
insert into table employee2 select emp_id, emp_desg, emp_add from employee;
工作正常
这是输出:
hive> select * from employee2;
OK
emp_id emp_desg emp_add
123 HiThere [{"dno":"Emp_Desg","state":null,"city":null,"zipcode":null}]
123 HiThere [{"dno":"Emp_Desg","state":null,"city":null,"zipcode":null}]
Time taken: 0.083 seconds, Fetched: 2 row(s)