← greater operator page · comparison/greater/ds_sc/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

DS_1 > 20: every measure value of DS_1 against a scalar, with a null measure.

Manual:

Greater than, Example 1, output verbatim: "The operator > returns true if left is greater than right, false otherwise."

Expected:

bool_var is true for F (29.5), false for R (12.2) and null for G, whose measure is null.

script.vtl ⇩

DS_r := DS_1 > 20;

input/DS_1.csv ⇩

Id_1Id_2Id_3Id_4Id_5Me_1
2G2011TotalPercentage
2R2011TotalPercentage12.2
2F2011TotalPercentage29.5

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": "Time_Period", "role": "Identifier", "nullable": false},
        {"name": "Id_4", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Id_5", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Id_3Id_4Id_5bool_var
2G2011TotalPercentage
2R2011TotalPercentagefalse
2F2011TotalPercentagetrue

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "Id_2", "type": "String", "role": "Identifier"},
        {"name": "Id_3", "type": "Time_Period", "role": "Identifier"},
        {"name": "Id_4", "type": "String", "role": "Identifier"},
        {"name": "Id_5", "type": "String", "role": "Identifier"},
        {"name": "bool_var", "type": "Boolean", "role": "Measure"}
      ]
    }
  ]
}