I am trying to find a way to split a row in Hive into multiple rows based on a delimited column. For example, taking a result set:
ID1 Subs 1 1, 2 2 2, 3
And coming back:
ID1 Subs 1 1 1 2 2 2 2 3
I found some road signs at http://osdir.com/ml/hive-user-hadoop-apache/2009-09/msg00092.html , however I could not tell me the direction of the solution in sufficient detail, and I donโt know how I set up a conversion function to return an object that will break lines.
Try this wording
SELECT ID1, Sub FROM tableName lateral view explode(split(Subs,',')) Subs AS Sub
SELECT ID1, new_Subs_clmn FROM tableName lateral view explode(split(Subs,',')) Subs AS new_Sub_clmn;
At first, I was puzzled by the names used, sharing the above query, thinking it would help.