Persistent assignment · <-
---
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
reis a persistent Data Set that has the same data structure as the Operand.”- Expected:
DS_rhas the structure and the data points ofDS_1.
DS_r <- DS_1;
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 2013 | Belgium | 5 | 5 |
| 2013 | Denmark | 2 | 10 |
| 2013 | France | 3 | 12 |
| 2013 | Spain | 4 | 20 |
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 2013 | Belgium | 5 | 5 |
| 2013 | Denmark | 2 | 10 |
| 2013 | France | 3 | 12 |
| 2013 | Spain | 4 | 20 |
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
opcan be obtained through an expression as complex as needed (for exampleopcan be the expressionDS_1 - DS_2)”, andre“assumes the same value asop” and “has the same data structure as the Operand”.- Expected:
The inputs have the same identifiers, so
Me_1is10 - 3 = 7and20 - 5 = 15, Integers (Subtraction page).
DS_r <- DS_1 - DS_2;
| Id_1 | Me_1 |
|---|---|
| 1 | 10 |
| 2 | 20 |
| Id_1 | Me_1 |
|---|---|
| 1 | 3 |
| 2 | 5 |
| Id_1 | Me_1 |
|---|---|
| 1 | 7 |
| 2 | 15 |
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
opis 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, whoseopisdataset | scalar.- Expected:
SC_r = 3, an Integer, as forSC_r := 3.
SC_r <- 3;
Name |
Type |
Value |
|---|---|---|
|
Integer |
|
Files: script.vtl · expected/scalars.json · example page ↗
Input value 🟢 pandas ✅ · DuckDB ✅
- Tests:
SC_r <- SC_1with the input scalarSC_1= 3: a scalar read from the input, assigned to a persistent result.- Manual:
Persistent assignment: “If the Operand
opis 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, whoseopisdataset | scalar.- Expected:
SC_r = 3, an Integer: the value ofSC_1, as forSC_r := SC_1.
SC_r <- SC_1;
| SC_1 |
|---|
| 3 |
Name |
Type |
Value |
|---|---|---|
|
Integer |
|
Files: script.vtl · input/scalars.csv · input/scalars.json · expected/scalars.json · example page ↗