Left Join and tMap

Highlighted
One Star

Left Join and tMap

Hi,
I have some questions about joins in the tMap component.
1/ If I use a left join (ie inner join is unchecked) between rowA and rowB, what does happen to the rowB structure when no rows matches the rowA ? Does rowB equals to null ? Or does rowB exists but with each of its field equal to null ?
2/ How can I test in the tMap if rowA did found a match or not ?
Thanks for your help.
Highlighted
Community Manager

Re: Left Join and tMap

Hello
1/ If I use a left join (ie inner join is unchecked) between rowA and rowB, what does happen to the rowB structure when no rows matches the rowA ? Does rowB equals to null ? Or does rowB exists but with each of its field equal to null ?

The columns from rowB will be null. see 1659.
2/ How can I test in the tMap if rowA did found a match or not ?

Link the output table to tLogRow which is used to display the result on console.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
One Star

Re: Left Join and tMap

Hi shong,
thanks for your reply.
So if rowA doesn't match rowB, all non nullable fields of rowB get default values ?
0 for integers, "" for Strings, 01/01/1970 for Dates and so on ?
That's really surprising...
So, how can I distinguish the case where rowB did match or not in the following case:
rowA (int id, String name)
0, Peter
1, John
2, Mark
rowB (int id, int amount)
1, 15
2, 10
After a left join I get: (id, name, amount)
0, Peter, 0
1, John, 15
2, Mark, 10
How do I know if Peter has an amount of 0 because it exists in rowB or if Peter doesn't exist in rowB ?
Highlighted
Employee

Re: Left Join and tMap

For the moment, it is necessary that at least one of your lookup's column be a nullable type.
Soon, a method call on the connection such as :
rowB.hasMatched()

will be possible.
There is an issue on this subject http://www.talendforge.org/bugs/view.php?id=1723
Highlighted
One Star

Re: Left Join and tMap

> For the moment, it is necessary that at least one of your lookup's column be a nullable type
Hi, even that is not a sufficient condition because the column could be null in the input data but ok, I will wait for the hasMatched() function.
Regards.

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog