Pentaho

 View Only

 How to merge rows with PDI?

Jump to Best Answer
Claudio Battaglino's profile image
Claudio Battaglino posted 01-19-2024 06:11

Hi,

I'm using Pentaho PDI (Spoon) to read data from an Oracle database and move them, after some manipulation, into Pentaho's Postgresql database.

Now I have to mix some rows based on a rule.

That is I have to mix couple of rows like these:

K1 K2 a3 a4 a5 a6

K1 K2 a3 a4 b5 b6

Where K1 K2 is the key to identify the rows that must be merged. 

Into a row like this one: K1 K2 a3 a4 a5 b6

Can I do this task with PDI? What blocks should I use according to you?

Thank you very much.

Claudio

Petr Prochazka's profile image
Petr Prochazka Best Answer

H Claudio,

for this you can use step Merge join. Conclusion of this step is that input stream MUST BE sorted by key field, for your ex. K1 andn K2. Output fields of this step will be K1 K2 a3 a4 a5 a6 K1_1 K2_2 a3_1 a4_1 b5 b6.

Or if you want add value b6 from second stream to first stream, you can use step Stream lookup. This step by defined key fields add values from lookup stream (for you from second stream). Be careful about this step, rows of lookup stream is loaded by this step to RAM.