← left_join operator page · join/left_join/apply/sum_of_homonym_measures

Sum of homonym measures 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

apply DS_1 + DS_2, written with the data set names, on the homonym measure Me_1.

Manual:

Left Join: apply "applies the expression to each of the n-uple of homonym Measures in the input data sets producing in the target a single homonym Measure for each n-uple", and "All the input measures do not appear".

Expected:

the four keys of DS_1: Me_1 := DS_1#Me_1 + DS_2#Me_1 is 11, null, 33 and 44; DS_2 has no (1,B), and the User Manual says "Whenever a null value is involved in a mathematical operation (+, -, ...), the result is null".

script.vtl ⇩

DS_r := left_join(DS_1, DS_2 apply DS_1 + DS_2);

input/DS_1.csv ⇩

Id_1Id_2Me_1
1A10
1B20
2A30
2B40

input/DS_1.json ⇩

{
  "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": "Number", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

input/DS_2.csv ⇩

Id_1Id_2Me_1
1A1
1C2
2A3
2B4

input/DS_2.json ⇩

{
  "datasets": [
    {
      "name": "DS_2",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Me_1
1A11
1B
2A33
2B44

expected/DS_r.json ⇩

{
  "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"}
      ]
    }
  ]
}