← cross_join operator page · join/cross_join/aliases/alias_prefixed_measures
pandas ✅ · DuckDB ✅
the measure Me_1 of both operands, named through the aliases (d1#Me_1, d2#Me_1) and renamed: the result depends on the operand each alias stands for.
Cross Join: the components of several data sets are in VDS₁ once per data set, and their "names ... are prefixed with the alias of the data set they come from, separated by the “#” symbol".
the cartesian product of DS_1 (Id_1 1, 2) and DS_2 (Id_2 A, B) has 2 × 2 = 4 data points: Me_11 holds the values of DS_1 (10, 10, 20, 20) and Me_12 those of DS_2 (1, 2, 1, 2). An engine that swapped the aliases would swap the columns.
DS_r := cross_join(DS_1 as d1, DS_2 as d2 rename d1#Me_1 to Me_11, d2#Me_1 to Me_12);
| 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_1 |
|---|---|
| A | 1 |
| B | 2 |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_11 | Me_12 |
|---|---|---|---|
| 1 | A | 10 | 1 |
| 1 | B | 10 | 2 |
| 2 | A | 20 | 1 |
| 2 | B | 20 | 2 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_11", "type": "Number", "role": "Measure"},
{"name": "Me_12", "type": "Number", "role": "Measure"}
]
}
]
}