Six Stars

How to perform a CROSS JOIN with Talend?

I have two row links from two different tables, and need to combined them in a Cartesian way. Any idea?

Could iterate link (instead of row link) helps me, somehow?

 

Thank you,

Lorenzo

 

---

The SQL CROSS JOIN produces a result set which is the number of rows in the first table multiplied by the number of rows in the second table.

This kind of result is called as Cartesian Product.

  • Data Integration
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Nine Stars TRF
Nine Stars

Re: How to perform a CROSS JOIN with Talend?

It works as expected:

Capture.PNG

Got 3 lines in main table ("aaaaa", "bbbbb", "ccccc") and 2 lines in the lookup ("AAAAA", "BBBBB").

The result contains 6 lines:

Starting job test at 20:01 29/05/2017.

[statistics] connecting to socket on port 4063
[statistics] connected
.-----+-----.
|tLogRow_35 |
|=----+----=|
|aaa  |bbb  |
|=----+----=|
|aaaaa|AAAAA|
|aaaaa|BBBBB|
|bbbb |AAAAA|
|bbbb |BBBBB|
|ccccc|AAAAA|
|ccccc|BBBBB|
'-----+-----'

[statistics] disconnected
Job test ended at 20:01 29/05/2017. [exit code=0]

Hope this helps.

 


TRF
4 REPLIES
Nine Stars TRF
Nine Stars

Re: How to perform a CROSS JOIN with Talend?

Never tried before, but what if you use a tMap with these 2 tables, 1 one as main and 1 as lookup, then no join in the tMap and an output flow based on fields from these tables?

TRF
Nine Stars TRF
Nine Stars

Re: How to perform a CROSS JOIN with Talend?

It works as expected:

Capture.PNG

Got 3 lines in main table ("aaaaa", "bbbbb", "ccccc") and 2 lines in the lookup ("AAAAA", "BBBBB").

The result contains 6 lines:

Starting job test at 20:01 29/05/2017.

[statistics] connecting to socket on port 4063
[statistics] connected
.-----+-----.
|tLogRow_35 |
|=----+----=|
|aaa  |bbb  |
|=----+----=|
|aaaaa|AAAAA|
|aaaaa|BBBBB|
|bbbb |AAAAA|
|bbbb |BBBBB|
|ccccc|AAAAA|
|ccccc|BBBBB|
'-----+-----'

[statistics] disconnected
Job test ended at 20:01 29/05/2017. [exit code=0]

Hope this helps.

 


TRF
Nine Stars TRF
Nine Stars

Re: How to perform a CROSS JOIN with Talend?

@Lorenzo, does this helps you?

TRF
Six Stars

Re: How to perform a CROSS JOIN with Talend?

Yes, thanks.