← sub operator page · clause/sub/multi_id/manual_ex_2

Manual example 2 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

sub Id_1 = 1, Id_2 = "B", Id_3 = "YY": every identifier fixed.

Manual:

Subspace, Example 2, output verbatim: "The resulting Data Set has the Identifier Components that are not specified as identifier (s) and has the same Measure and Attribute Components of the input Data Set."

Expected:

The data point (1,B,YY) alone, with no identifiers: Me_1 = 9 and At_1 = F.

script.vtl ⇩

DS_r := DS_1 [ sub Id_1 = 1, Id_2 = "B", Id_3 = "YY" ];

input/DS_1.csv ⇩

Id_1Id_2Id_3Me_1At_1
1AXX20F
1AYY1F
1BXX4E
1BYY9F
2AXX7F
2AYY5E
2BXX12F
2BYY15F

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": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
        {"name": "At_1", "type": "String", "role": "Attribute", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Me_1At_1
9F

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Me_1", "type": "Integer", "role": "Measure"},
        {"name": "At_1", "type": "String", "role": "Attribute"}
      ]
    }
  ]
}