Search code examples
pentahokettlenormalize

reverse of group concat in kettle pentaho


In Pentaho Kettle I have at some point some data like this (they are in fact the result of a complex ldap query)

x            y
foo          apple , banana , pear
bar          potato , carrot , tomato

where x and y are column of my table and y it's a plain string

I want to normalize the table transforming it in

x         y
foo       apple
foo       banana
foo       pear
bar       potato
bar       carrot
bar       tomato

It is possible to do so? Maybe with a javascript step?


Solution

  • You can use "Split field to rows" step in PDI. Use the Deliminator as ",", it will split the rows to your required output.

    Placed a gist in here. You can check the code.