执行HQL直接被退出:Remote side unexpectedly closed network connection


HQL语句

select city,layer, avg(total/size) from 
(
select city,houseinfo[0] layer,substring(houseinfo[4],0,length(houseinfo[4])-2) as size, 
total from tb_ke_house 
) t
group by city,layer;

执行情况描述

执行上述HQL,当执行到Map阶段时候,直接退出了当前执行语句,hdfs集群页一并被强制停止了。

原因

隐式转换带来的问题,修改HQL语句将size在子查询中做cast强制转换

正确HQL

select city,layer, avg(total/size) from 
(
select city,houseinfo[0] layer,cast(substring(houseinfo[4],0,length(houseinfo[4])-2) as int) as size, 
total from tb_ke_house 
) t
group by city,layer;

结束!