← left_join operator page · join/left_join/aliases/alias_prefixed_measures

Alias prefixed measures 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

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.

Manual:

Left Join: the components in 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".

Expected:

the four keys of DS_1: Me_11 holds the values of DS_1 (10, 20, 30, 40) and Me_12 those of DS_2 (1, null, 3, 4). An engine that swapped the aliases would swap the columns.

script.vtl ⇩

DS_r := left_join(DS_1 as d1, DS_2 as d2 rename d1#Me_1 to Me_11, d2#Me_1 to Me_12);

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_11Me_12
1A101
1B20
2A303
2B404

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_11", "type": "Number", "role": "Measure"},
        {"name": "Me_12", "type": "Number", "role": "Measure"}
      ]
    }
  ]
}