Reputation: 3069
I need to parse the following line using Java, which is generated as a result of Pig group function.
(D1,{(A1,null,C1,D1,E1),(null,B1,C1,D1,E1),(A2,null,null,D1,E2)})
Here D1 is the Key, and (A1,null,C1,D1,E1),(null,B1,C1,D1,E1),(A2,null,null,D1,E2)
are the corresponding values.
I am looking for a java pgm to retain only the values. However split function on ',' cant be applied directly as the inner elements also contain , delimiter.
Upvotes: 0
Views: 73
Reputation: 3411
A crappy DIY solution would be to first isolate "(A1,null,C1,D1,E1),(null,B1,C1,D1,E1),(A2,null,null,D1,E2)"
, then split that on "),("
so that you have "(A1,null,C1,D1,E1"
, "null,B1,C1,D1,E1"
, and "A2,null,null,D1,E2)"
. Remove extraneous parentheses, and then split on commas for each one as you wanted.
Upvotes: 1