Hive行转列函数
concat
select e
.empno
,e
.ename
,e
.job
,concat
(e
.empno
,e
.ename
,e
.job
) from emp e
;
cancat_ws:concat加强版,但是只能够处理string,所以需要强转
select e
.empno
,e
.ename
,e
.job
,concat_ws
('-',case(e
.empno
as string
),e
.ename
,e
.job
) from emp e
;
collect_list:多行转一列,不去重
select collect_list
(deptno
) from emp
;
collect_set:多行转一列,去重
select collect_set
(deptno
) from emp
;
转载请注明原文地址:https://blackberry.8miu.com/read-1242.html