Hadoop/Hive - Split a single row into multiple rows

前端 未结 2 1566
渐次进展
渐次进展 2020-12-09 13:14

I\'m trying to find a way to split a row in Hive into multiple rows based on a delimited column. For instance taking a result set:

ID1  Subs
1     1, 2
2            


        
相关标签:
2条回答
  • 2020-12-09 13:54
    SELECT ID1, new_Subs_clmn
    FROM tableName lateral view explode(split(Subs,',')) Subs AS new_Sub_clmn;
    

    I was initially confused with the names used, sharing the above query thinking it would be of help.

    0 讨论(0)
  • 2020-12-09 14:00

    Try this wording

    SELECT ID1, Sub
    FROM tableName lateral view explode(split(Subs,',')) Subs AS Sub  
    
    0 讨论(0)
提交回复
热议问题