kettle pentaho 中 group concat 的反转

reverse of group concat in kettle pentaho

在 Pentaho Kettle 中,我有时会有这样的数据 (它们实际上是复杂的 ldap 查询的结果)

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

其中 xy 是我的 table 的列,y 它是一个纯字符串

我想规范化 table 将其转换为

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

有可能吗?也许需要 javascript 步?

您可以在 PDI 中使用“拆分字段到行”步骤。使用 Deliminator 作为“,”,它会将行拆分为您需要的输出。

在这里放了一个gist。您可以查看代码。