This is an old revision of the document!
Cross merge
This action creates a table with all possible combinations (i.e. Cartesian product) of rows in two table.
It can be helpful in a number of cases: generating a custom calendar, or for performing a complex merging/matching, where all possible combinations are later filtered using a complex condition. Note that this action can produce extremely large tables, so make sure that you’re not cross-merging large tables. To estimate the number of rows in the resulting table multiply the number of rows in both source datasets.
Note that EasyMorph can handle tables with up to 536 million records only.
EXAMPLE
Table: Years
Year |
---|
2016 |
2017 |
Table: Quarters
Quarter |
---|
Q1 |
Q2 |
Q3 |
Q4 |
Objective: Create a custom calendar with quarters in years 2016-2017.
Transformation: Cross-merge. Table "Years" has 2 rows, table "Quarters" has 4 rows. Therefore, the resulting dataset will have 2 x 4 = 8 rows.
Result:
Year | Quarter |
---|---|
2016 | Q1 |
2016 | Q2 |
2016 | Q3 |
2016 | Q4 |
2017 | Q1 |
2017 | Q2 |
2017 | Q3 |
2017 | Q4 |