← sub operator page · clause/sub/one_id/fixed_identifier_dropped

Fixed identifier dropped 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

sub Id_1 = 1, alone, on one of two identifiers.

Manual:

Subspace: "It maintains the Data Points of VDS for which identifier = value (for all the specified identifier) and eliminates all the Data Points for which identifier <> value", then "It projects out (“drops”, in VTL terms) all the identifier (s)".

Expected:

(1,A) = 10 and (1,B) = 20 are kept and (2,A) = 30 is eliminated; Id_1 is projected out, leaving Id_2 and Me_1. Manual example 3 adds two subspaces with +; this one shows sub alone.

script.vtl ⇩

DS_r := DS_1 [ sub Id_1 = 1 ];

input/DS_1.csv ⇩

Id_1Id_2Me_1
1A10
1B20
2A30

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

expected/DS_r.csv ⇩

Id_2Me_1
A10
B20

expected/DS_r.json ⇩

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