PDA

View Full Version : Problem with merging a few values into one row



laplas
06-30-2008, 06:47 AM
I'm novice in Kettle.I have problem with merging a few values (single values extracted from few source tables as aggregated values) from several input tables into one composite row to output table.

I got such error: "The name of field number 1 is not the same as in the first row received"

Is there in Kettle any possiblity to merge/consolidate a few values (each from another input table) into one row to send to one output table ?


Thanks in advance.

MattCasters
06-30-2008, 07:18 AM
You can merge in the values of a single row in, for example with a "Join Rows (Cartesian product)" step.

sboden
06-30-2008, 07:21 AM
@OP: You got the adding of data to a stream the wrong way.

Every row flowing over the same hop has to be the same structure ... same names, types, ... you can't just dump several different input streams together and hope they join well... they won't :D

Check out e.g. the merge join step (under joins category).

Regards,
Sven

brel
06-30-2008, 12:08 PM
I've a similar problem and I find that doing a merge join is quite messy. For example if table 1 has:
ID = 2
VAL1 = 3

And table 2 has:
ID = 2
VAL2 = 5

Merge join gives:
ID = 2
VAL1 = 3
ID_1 = 2
VAL2 = 5

But what one wants is:
ID = 2
VAL1 = 3
VAL2 = 5

This is a simple example but one can't just drop ID_1 for all inputs because when an ID in table 2 doesn't match an ID in table 1, ID is null. I'm currently using javascript to clear up this problem but why not have the step do this cleanup automatically?