← inner_join operator page · join/inner_join/apply/manual_ex_4
pandas ✅ · DuckDB ✅
apply d1 || d2, written with the aliases, on two operands that both have Me_1 and Me_2.
Inner Join, Example 4, output verbatim: "apply combines the homonym Measures in the source operands", and "The expression applyExpr can use as input the names or aliases of the operand data sets".
the join keeps (1,A) and (1,B): Me_1 := d1#Me_1 || d2#Me_1 gives AB and CS, Me_2 := d1#Me_2 || d2#Me_2 gives BQ and DT.
DS_r := inner_join (DS_1 as d1, DS_3 as d2 apply d1 || d2);
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 1 | A | A | B |
| 1 | B | C | D |
| 2 | A | E | F |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 1 | A | B | Q |
| 1 | B | S | T |
| 3 | A | Z | M |
{
"datasets": [
{
"name": "DS_3",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 1 | A | AB | BQ |
| 1 | B | CS | DT |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "String", "role": "Measure"},
{"name": "Me_2", "type": "String", "role": "Measure"}
]
}
]
}