← full_join operator page · join/full_join/aggr_measure/explicit_measure_role

Explicit measure role 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

aggr with the role keyword measure written out.

Manual:

Full Join: aggrRole ::= { measure | attribute | viral attribute }, and "if the role is not specified, it will be measure".

Expected:

the result of Sum by id 1, which leaves the role out: Me_3 is 30 for Id_1 = 1 and 70 for Id_1 = 2.

script.vtl ⇩

DS_r := full_join(DS_1, DS_2 aggr measure Me_3 := sum(Me_1) group by Id_1);

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

expected/DS_r.csv ⇩

Id_1Me_3
130
270

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "Me_3", "type": "Number", "role": "Measure"}
      ]
    }
  ]
}