Page 1 of 1

how to do left join in transformer

Posted: Tue May 13, 2008 1:15 pm
by Jessie
all,

how to do left join or left outer join in transformer?

thanks in advance

Posted: Tue May 13, 2008 1:21 pm
by chulett
How about some details about what you are trying to accomplish? Join 'in transformer' with what - hashed file?

Posted: Tue May 13, 2008 1:32 pm
by Jessie
Yes, I want to left join with hash file.

use 'transformer' to join a sequence file with 2 hash files. each of the 3 files has some rows that cannot be joined with, and I want all the row from all the 3 files. how to do it?

thanks

Posted: Tue May 13, 2008 2:38 pm
by vivekgadwal
Jessie wrote: each of the 3 files has some rows that cannot be joined with, and I want all the row from all the 3 files. how to do it?

thanks
Jessie,

According to my understanding of your problem, why don't you use the Merge stage to join the files. If you need to get the data from 3 files, Use merge stage to combine two files into one and then, may be use another merge stage (in a separate job, of course) and combine the files? Is there a specific reason why you are creating Hash files or is it for this joining purpose itself?

Posted: Tue May 13, 2008 3:35 pm
by Jessie
I'm working on 'Merge', waht should I do after 'merge'?
the out put file from 'merge, has file1.key, file2.key
how do I join them to make it one row?

thanks

Posted: Tue May 13, 2008 3:58 pm
by vivekgadwal
Jessie wrote: the out put file from 'merge, has file1.key, file2.key
how do I join them to make it one row?

thanks
Jessie,

The way you join is, say, File1.Key and File2.Key need to be joined, in the Outputs page, under Mapping tab, you drag and drop the same in the specified areas where it says "Drag From File Column Names to populate map keys".

Please note that you specify the kind of join you require in the Output page\General Tab.

These steps combined with populating all the other fields in the Outputs page correctly should do the trick :) . I have not used Merge stage as much, but it should work fine. Also, please do refer to the documentation on Merge stage provided along with the tool.

Hope this helps...

Posted: Tue May 13, 2008 4:20 pm
by Jessie
here is what I need to do.

file1
Col1 col2 col3 col4
Key1 key2 22 33
Keya keyb 12 23

File 2

Col1 col2 col3 col4
Key1 key2 44 55
keyc keyd 45 54

After merge- the file should looks like

Col1 col2 col3 col4, clo5, col6
Key1 key2 22 33 44 55
keya keyb 12 23
keyc keyd 45 54

Posted: Tue May 13, 2008 4:24 pm
by vivekgadwal
Jessie wrote: After merge- the file should looks like

Col1 col2 col3 col4, clo5, col6
Key1 key2 22 33 44 55
keya keyb 12 23
keyc keyd 45 54
Ok... Did you try the way I suggested? Did it work? Let me know.

Re: how to do left join in transformer

Posted: Tue May 13, 2008 4:42 pm
by ray.wurlod
Jessie wrote:how to do left join or left outer join in transformer?
A lookup from a server Transformer stage is inherently a left outer join; it returns null for all columns on the reference link if the lookup does not succeed.

Posted: Tue May 13, 2008 4:56 pm
by Jessie
[quote="vivekgadwal"][quote="Jessie"]
After merge- the file should looks like

Col1 col2 col3 col4, clo5, col6
Key1 key2 22 33 44 55
keya keyb 12 23
keyc keyd 45 54[/quote]

Ok... Did you try the way I suggested? Did it work? Let me know.[/quote]

workingn on it, I'll report to you tomorrow :P