Row switch and column switch in column hive

https://www.cnblogs.com/zzhangyuhang/p/9791795.html

https://www.cnblogs.com/blogyuhan/p/9274784.html

Column switch: 
user_id order_id 104 399 1,715,131 104 399 2105395 104 399 1758844 104 399 981 085 104 399 2444143 104 399 1,458,638 104 399 968 412 104 400 1,609,001 104 400 2986088 104 400 1,795,054

User_id of the same line order_id Switch according comma: SELECT user_id, CONCAT_WS ( ',', collect_list (order_id)) AS ORDER_VALUE  from col_lie  Group by user_id

Line transfer columns:

user_id    order_value
104408    2909888,2662805,2922438,674972,2877863,190237
select user_id,order_value,order_id
from lie_col
lateral view explode(split(order_value,',')) num as order_id
limit 10;

Guess you like

Origin www.cnblogs.com/18800105616a/p/11428814.html