欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

hive字符串操作切割,切割后转行

时间:2023-04-18
split

SELECt split("1,2,3",",")

结果

[1,2,3]

explode

SELECT explode(SPLIT( "1,2,3",","))

结果

###

LATERAL VIEW explode()

SELECT t1.id ,t.valueFROM ( SELECT 1 AS id ,"1,2,3" AS DATA UNIOn ALL SELECT 2 AS id ,"1,2,3" AS DATA UNIOn ALL SELECT 3 AS id ,"1,2,3" AS DATA ) t1LATERAL VIEW explode(SPLIT(data,",")) t AS valueWHERe t1.id = '1';

结果

id value111213

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。