← unary_plus operator page · numeric/unary_plus/ds/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

+ on a dataset with a Number measure and an Integer measure.

Manual:

Unary plus, Example 1, output verbatim: "The operator + returns the operand unchanged."

Expected:

both measures come back unchanged and keep their types: Me_1 (Number) 1.0, 2.3 and 3.2, Me_2 (Integer) 5, 10 and 12.

script.vtl ⇩

DS_r := + DS_1;

input/DS_1.csv ⇩

Id_1Id_2Me_1Me_2
10A1.05
10B2.310
11A3.212

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

expected/DS_r.csv ⇩

Id_1Id_2Me_1Me_2
10A1.05
10B2.310
11A3.212

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_1", "type": "Number", "role": "Measure"},
        {"name": "Me_2", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}