【发布时间】:2018-05-08 17:04:19
【问题描述】:
我已阅读网站上的所有示例,但没有一个适合我。我添加了 Brickhouse UDFS:create temporary function collect_struct as 'brickhouse.udf.collect.CollectUDAF' 和
CREATE TEMPORARY FUNCTION collect AS 'brickhouse.udf.collect.CollectUDAF'
我使用了来自Hive SELECT statement to create an ARRAY of STRUCTS 和
Hive select data into an array of structs 的示例
我的 SQL:
create temporary function collect as 'brickhouse.udf.collect.CollectUDAF';
CREATE TABLE test ( <br>
house_id bigint,<br>
first_name string,<br>
last_name string<br>
);
INSERT INTO test VALUES<br>
(1,"Bob","jones"),<br>
(1,"Jenny","jones"),<br>
(2,"Sally","johnson"),<br>
(3,"John","smith"),<br>
(3,"Barb","smith");
select house_id<br>
,collect(named_struct("first_name", first_name, "last_name", last_name))<br>
from test<br>
group by house_id;
我总是遇到同样的错误:
失败:ClassCastException org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector 不能转换为 org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector
有什么想法吗?
【问题讨论】:
-
请与错误分享您的完整堆栈跟踪
-
这是我得到的唯一错误:
-
请转到您的 JobTracker 并跟踪您的 Hive 工作的 jobid。找到其中的日志,它应该向您显示在不同节点上为不同尝试收集的详细日志。找到它们时发布!
-
Hive 没有创建作业 - 它立即失败:
hive> select house_id > ,collect(named_struct("first_name", first_name, "last_name", last_name)) > from test > group by house_id; FAILED: ClassCastException org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector cannot be cast to org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector hive> -
你发现了吗?我遇到了同样的问题。