← addition operator page · numeric/addition/sc_comp/integer_plus_integer

Integer plus integer 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

a scalar added to an Integer component, inside calc.

Manual:

Addition: "If the type of both operands is integer then the result has type integer."

Expected:

Me_3 = 3 + Me_1 is 5, 7 and 8, an Integer; the other components are kept.

script.vtl ⇩

DS_r := DS_1[calc Me_3 := 3 + Me_1];

input/DS_1.csv ⇩

Id_1Me_1Me_2
122.5
244.0
350.5

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

expected/DS_r.csv ⇩

Id_1Me_1Me_2Me_3
122.5000005
244.0000007
350.5000008

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "Me_1", "type": "Integer", "role": "Measure"},
        {"name": "Me_2", "type": "Number", "role": "Measure"},
        {"name": "Me_3", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}