如果有一种字段a,b为下面这种

         event_id  ---1,3,4,6

        user_id ---2,8,9,7

        希望变成

event_id  1
event_id  3
event_id  4
event_id  6
user_id 2
user_id 8
user_id 9
user_id 7

hive 中查询sql 使用关键字     LATERAL VIEW

select event_id, col  from  table LATERAL VIEW explode(split(user_id,",")) t AS col;

presto 中查询获取关键字为   CROSS JOIN UNNEST

SELECT  id
FROM v_event_0
CROSS JOIN UNNEST(split("event_id",',')) AS t (id) LIMIT 100

查询presto api如下

presto中查询行列转换 与 hive 对比

相关文章: