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

split

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

结果

[1,2,3]

explode

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

结果

1
2
3

LATERAL VIEW explode()


SELECT  t1.id
        ,t.value
FROM    (
            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
        ) t1
LATERAL VIEW explode(SPLIT(data,",")) t AS value
WHERE   t1.id = '1'
;

结果

id value
1	1
1	2
1	3

你可能感兴趣的:(瞎写,hive,hadoop,数据仓库)