Persistent assignment · <-

🟢 3 of 3 forms all ok · VTL 2.2 Reference Manual ↗ · vtlengine 1.10.0rc2 (90ee9376) · pandas 2.3.3 · DuckDB 1.5.5
🟢 all ok🟡 partially implemented🛡️ refused with an error🔴 not implemented or crash🔵 engines differ ✅ match · ❌ wrong result · 🛡 guarded error (code) · 💥 crash · 📌 team decision
Dataset formsComponent formsScalar forms
        ---
config:
  flowchart:
    useMaxWidth: false

---
flowchart TB
    classDef ok fill:#d4edda,stroke:#28a745,color:#000
    classDef partial fill:#fff3cd,stroke:#ffc107,color:#000
    classDef refused fill:#d4edda,stroke:#28a745,stroke-width:3px,stroke-dasharray: 2 2,color:#000
    classDef missing fill:#f8d7da,stroke:#dc3545,color:#000
    classDef diverge fill:#cce5ff,stroke:#007bff,color:#000
    classDef block fill:#2b3a4a,stroke:#2b3a4a,color:#fff,font-weight:bold
    classDef ext fill:#fff,stroke:#666,color:#000,stroke-dasharray: 5 5
    O["Persistent assignment · #60;-<br/>🟢3"]:::ok
    subgraph G_ds["Dataset"]
        direction LR
        v_identity["DS_r #60;- DS"]:::ok
        v_expression["DS_r #60;- expr"]:::ok
    end
    subgraph G_sc["Scalar"]
        direction LR
        v_sc["SC_r #60;- sc"]:::ok
    end
    O --- G_ds
    O --- G_sc
    style G_ds fill:#f8f9fa,stroke:#495057,stroke-width:2px
    style G_sc fill:#f8f9fa,stroke:#495057,stroke-width:2px,stroke-dasharray: 2 3
    click v_identity href "#form-identity"
    click v_expression href "#form-expression"
    click v_sc href "#form-sc"
    

Types

Takes any scalar · Gives any type

Comes from: any operator that returns a value

Goes to: whatever takes its input's type

Forms

DS_r <- DS 🟢 · any scalar → any type

Manual example 1 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_r <- DS_1: a dataset assigned as it is to a persistent result.

Manual:

Persistent assignment, Example 1, output verbatim: “The result re is a persistent Data Set that has the same data structure as the Operand.”

Expected:

DS_r has the structure and the data points of DS_1.

script.vtl
DS_r <- DS_1;
Input DS_1
Id_1Id_2Me_1Me_2
2013Belgium55
2013Denmark210
2013France312
2013Spain420
Expected DS_r
Id_1Id_2Me_1Me_2
2013Belgium55
2013Denmark210
2013France312
2013Spain420

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

DS_r <- expr 🟢 · any scalar → any type

Dataset subtraction 🟢 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
Id_1Me_1
110
220
Input DS_2
Id_1Me_1
13
25
Expected DS_r
Id_1Me_1
17
215

Files: script.vtl · input/DS_1.csv · input/DS_1.json · input/DS_2.csv · input/DS_2.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

SC_r <- sc 🟢 · any scalar → any type

Integer literal 🟢 pandas ✅ · DuckDB ✅
Tests:

SC_r <- 3: a scalar assigned to a persistent result.

Manual:

Persistent assignment: “If the Operand op is a scalar value, the result Data Set has no Components and contains only such a scalar value”, as in “income <- 3”. That contradicts the page’s “Input parameters type”, op :: dataset, and its “Result type”, result :: dataset: the example follows the Behaviour, as does the non-persistent assignment, whose op is dataset | scalar.

Expected:

SC_r = 3, an Integer, as for SC_r := 3.

script.vtl
SC_r <- 3;
Expected scalars

Name

Type

Value

SC_r

Integer

"3"

Files: script.vtl · expected/scalars.json · example page ↗

Input value 🟢 pandas ✅ · DuckDB ✅
Tests:

SC_r <- SC_1 with the input scalar SC_1 = 3: a scalar read from the input, assigned to a persistent result.

Manual:

Persistent assignment: “If the Operand op is a scalar value, the result Data Set has no Components and contains only such a scalar value”, as in “income <- 3”. That contradicts the page’s “Input parameters type”, op :: dataset, and its “Result type”, result :: dataset: the example follows the Behaviour, as does the non-persistent assignment, whose op is dataset | scalar.

Expected:

SC_r = 3, an Integer: the value of SC_1, as for SC_r := SC_1.

script.vtl
SC_r <- SC_1;
Input scalars
SC_1
3
Expected scalars

Name

Type

Value

SC_r

Integer

"3"

Files: script.vtl · input/scalars.csv · input/scalars.json · expected/scalars.json · example page ↗