← cross_join operator page · join/cross_join/calc_attribute/constant_attribute
pandas ✅ · DuckDB ✅
calc attribute At_1 := "EP", a constant attribute.
Cross Join: "calc calculates new components by independent sub-expressions evaluated at component level. The role of the new components can be specified". The calc clause page has the same calculation, DS_1 [ calc attribute At_1:= "EP" ] (its Example 2).
the cartesian product of DS_1 (Id_1 1, 2) and DS_2 (Id_2 A, B) has 2 × 2 = 4 data points, and each gets the String Attribute At_1 = EP.
DS_r := cross_join(DS_1, DS_2 calc attribute At_1 := "EP");
| 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_1 | Id_2 | Me_1 | Me_2 | At_1 |
|---|---|---|---|---|
| 1 | A | 10 | 1 | EP |
| 1 | B | 10 | 2 | EP |
| 2 | A | 20 | 1 | EP |
| 2 | B | 20 | 2 | EP |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"},
{"name": "Me_2", "type": "Number", "role": "Measure"},
{"name": "At_1", "type": "String", "role": "Attribute"}
]
}
]
}