Talend - How to do cross join in Talend tmap
We can very easily do cross join in tmap.
All we need to do is select your Main and Lookup flow into tMap and then expression Key section do not mention anything. Just do not mention any join condition. see below
tFixedFlowInput_1 - is fixed input for countryname - india, germany - resulting in two rows
tFixedFlowInput_2 - is fixed input for cityname - delhi,frankfurt - resulting in two rows,
tMap we input both tFixedFlowInput_1 and tFixedFlowInput_2 and then do not specify any join condition and result output is 4 rows (2X2) - cross join.
Output of job is below
Starting job jobforblog at 18:10 02/10/2013.
[statistics] connecting to socket on port 4006
[statistics] connected
.---------.
|tLogRow_2|
|=-------=|
|CityName |
|=-------=|
|DELHI |
|FRANKFURT |
'---------'
.-----------.
| tLogRow_1 |
|=---------=|
|CountryName|
|=---------=|
|INDIA |
|GERMANY |
'-----------'
.-----------+---------.
| tLogRow_3 |
|=----------+--------=|
|CountryName|CityName |
|=----------+--------=|
|INDIA |DELHI |
|INDIA |FRANKFURT |
|GERMANY |DELHI |
|GERMANY |FRANKFURT |
'-----------+---------'
[statistics] disconnected
Job jobforblog ended at 18:10 02/10/2013. [exit code=0]
[statistics] connecting to socket on port 4006
[statistics] connected
.---------.
|tLogRow_2|
|=-------=|
|CityName |
|=-------=|
|DELHI |
|FRANKFURT |
'---------'
.-----------.
| tLogRow_1 |
|=---------=|
|CountryName|
|=---------=|
|INDIA |
|GERMANY |
'-----------'
.-----------+---------.
| tLogRow_3 |
|=----------+--------=|
|CountryName|CityName |
|=----------+--------=|
|INDIA |DELHI |
|INDIA |FRANKFURT |
|GERMANY |DELHI |
|GERMANY |FRANKFURT |
'-----------+---------'
[statistics] disconnected
Job jobforblog ended at 18:10 02/10/2013. [exit code=0]