← unpivot operator page · clause/unpivot/basic/null_measure_skipped

Null measure skipped 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

unpivot Id_2, Me_3, on a data point whose Me_2 is null.

Manual:

Unpivoting: "For each Data Point DP and for each Measure M of op whose value is not null, the operator inserts a Data Point into VDS", and "When a Measure is null then unpivot does not create a Data Point for that Measure."

Expected:

(1, Me_1) = 5, (2, Me_1) = 3 and (2, Me_2) = 4, with no data point for the null Me_2 of Id_1 = 1. Id_2 holds component names, so it is a String, and Me_3 has the type of the measures, Integer.

script.vtl ⇩

DS_r := DS_1 [ unpivot Id_2, Me_3 ];

input/DS_1.csv ⇩

Id_1Me_1Me_2
15
234

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
        {"name": "Me_2", "type": "Integer", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Me_3
1Me_15
2Me_13
2Me_24

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