I have two input tables, 1 is a list of fruit, and 2 has 3 columns of fruit with some missing values on each row. I want to make a table with combinations of the fruit under the constraint of table 2. I try to find all combinations of input table 1 with cross-joiners to itself but get “out of memory error” as the list is huge. If I fill out the missing values under the constraint of input table 2, hopefully, the task is smaller.
Input table 1
set |
---|
[apple, banana, orange, pineapple] |
Input table 2
fruit1 | fruit2 | fruit3 |
---|---|---|
apple | banana | |
banana | pineapple | |
orange | banana |
Output table
row | fruit1 | fruit2 | fruit3 |
---|---|---|---|
row0 | apple | orange | banana |
row1 | apple | pineapple | banana |
row2 | banana | pineapple | orange |
row3 | banana | pineapple | apple |
row4 | pineapple | orange | banana |
On output table. row0 and row1 are the combinations under the first row constraint of input table 2 (orange and pineapple for the missing value on first row), row2 and row3 are the combinations under the second row constraint of input table 2. Row4 is the combination under third row, another combination “apple” is removed as it is the same as row0.