← cross_join operator page · join/cross_join/nary/three_operands
pandas ✅ · DuckDB ✅
a cross join of three operands with no common component.
Cross Join: "In each step, a data point in VDS₁ is generated for each pair of data points in the partial result and the joined data set", and "the step is repeated by joining this partial result to the next data set".
DS_3 has Id_3 P and Q: 2 × 2 × 2 = 8 data points, with Id_1, Id_2, Id_3 and the three measures.
DS_r := cross_join(DS_1, DS_2, DS_3);
| Id_1 | Me_1 |
|---|---|
| 1 | 10 |
| 2 | 20 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_2 | Me_2 |
|---|---|
| A | 1 |
| B | 2 |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_2", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_3 | Me_3 |
|---|---|
| P | 100 |
| Q | 200 |
{
"datasets": [
{
"name": "DS_3",
"DataStructure": [
{"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_3", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Id_3 | Me_1 | Me_2 | Me_3 |
|---|---|---|---|---|---|
| 1 | A | P | 10 | 1 | 100 |
| 1 | A | Q | 10 | 1 | 200 |
| 1 | B | P | 10 | 2 | 100 |
| 1 | B | Q | 10 | 2 | 200 |
| 2 | A | P | 20 | 1 | 100 |
| 2 | A | Q | 20 | 1 | 200 |
| 2 | B | P | 20 | 2 | 100 |
| 2 | B | Q | 20 | 2 | 200 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Id_3", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"},
{"name": "Me_2", "type": "Number", "role": "Measure"},
{"name": "Me_3", "type": "Number", "role": "Measure"}
]
}
]
}