← persistent_assignment operator page · general/persistent_assignment/expression/dataset_subtraction

Dataset subtraction 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

DS_r <- DS_1 - DS_2: the result of an expression assigned to a persistent result.

Manual:

Persistent assignment: "the operand op can be obtained through an expression as complex as needed (for example op can be the expression DS_1 - DS_2)", and re "assumes the same value as op" and "has the same data structure as the Operand".

Expected:

The inputs have the same identifiers, so Me_1 is 10 - 3 = 7 and 20 - 5 = 15, Integers (Subtraction page).

script.vtl ⇩

DS_r <- DS_1 - DS_2;

input/DS_1.csv ⇩

Id_1Me_1
110
220

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}
      ]
    }
  ]
}

input/DS_2.csv ⇩

Id_1Me_1
13
25

input/DS_2.json ⇩

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

expected/DS_r.csv ⇩

Id_1Me_1
17
215

expected/DS_r.json ⇩

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