Equal to · =
---
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["Equal to · =<br/>🟢7"]:::ok
subgraph G_ds["Dataset"]
direction LR
v_ds_ds["DS = DS"]:::ok
v_ds_sc["DS = sc"]:::ok
v_sc_ds["sc = DS"]:::ok
end
subgraph G_comp["Component"]
direction LR
v_comp_comp["comp = comp"]:::ok
v_comp_sc["comp = sc"]:::ok
v_sc_comp["sc = comp"]:::ok
end
subgraph G_sc["Scalar"]
direction LR
v_sc_sc["sc = sc"]:::ok
end
O --- G_ds
O --- G_comp
O --- G_sc
style G_ds fill:#f8f9fa,stroke:#495057,stroke-width:2px
style G_comp fill:#f8f9fa,stroke:#495057,stroke-width:2px,stroke-dasharray: 8 5
style G_sc fill:#f8f9fa,stroke:#495057,stroke-width:2px,stroke-dasharray: 2 3
click v_ds_ds href "#form-ds-ds"
click v_ds_sc href "#form-ds-sc"
click v_sc_ds href "#form-sc-ds"
click v_comp_comp href "#form-comp-comp"
click v_comp_sc href "#form-comp-sc"
click v_sc_comp href "#form-sc-comp"
click v_sc_sc href "#form-sc-sc"
Types
Takes any scalar · Gives boolean
Comes from: any operator that returns a value
Goes to · boolean — 27 operators in 8 blocks 🟢27
General purpose operators (1) 🟢1
Join operators (4) 🟢4
Boolean operators (4) 🟢4
Aggregate and Analytic operators (10) 🟢10
Data validation operators (1) 🟢1
Conditional operators (2) 🟢2
Clause operators (2) 🟢2
Definitions (VTL-DL) (3) 🟢3
Goes to · operators that take any scalar — 37 operators in 8 blocks 🟢37
General purpose operators (6) 🟢6
Comparison operators (10) 🟢10
Set operators (4) 🟢4
Aggregate and Analytic operators (7) 🟢7
Data validation operators (1) 🟢1
Conditional operators (1) 🟢1
Clause operators (7) 🟢7
Definitions (VTL-DL) (1) 🟢1
Forms
DS = DS 🟢 · any scalar → boolean
Reordered data points and null 🟢 pandas ✅ · DuckDB ✅
- Tests:
DS_1 = DS_2, whereDS_2lists its data points in another order thanDS_1and has a null measure.- Manual:
Equal to: “The operator returns true if the left is equal to right, false otherwise.” The data points that couple are those “which have the same values as for the common Identifiers” (Typical behaviours).
- Expected:
bool_var, the page’s measure for a data set result, is false, true, false and null for ids 1 to 4: 2 = 2 is true;DS_2lists id 3 first, but data points pair by identifier, not by position, and id 4 faces a null. A null operand gives a null result, as in the output of the page’s Example 1; the User Manual says: “most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null”.
DS_r := DS_1 = DS_2;
| Id_1 | Me_1 |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| Id_1 | Me_1 |
|---|---|
| 3 | 1 |
| 1 | 3 |
| 4 | |
| 2 | 2 |
| Id_1 | bool_var |
|---|---|
| 1 | false |
| 2 | true |
| 3 | false |
| 4 |
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 ↗
DS = sc 🟢 · any scalar → boolean
Manual example 1 🟢 pandas ✅ · DuckDB ✅
- Tests:
DS_1 = 0.08: every measure value ofDS_1against a scalar, with a null measure.- Manual:
Equal to, Example 1, output verbatim: “The operator returns true if the left is equal to right, false otherwise.”
- Expected:
bool_varis true for F and W, whose measure is 0.08, false for G, S and M, and null for B, whose measure is null.
DS_r := DS_1 = 0.08;
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| 2012 | B | Total | Total | |
| 2012 | G | Total | Total | 0.286 |
| 2012 | S | Total | Total | 0.064 |
| 2012 | M | Total | Total | 0.043 |
| 2012 | F | Total | Total | 0.08 |
| 2012 | W | Total | Total | 0.08 |
| Id_1 | Id_2 | Id_3 | Id_4 | bool_var |
|---|---|---|---|---|
| 2012 | B | Total | Total | |
| 2012 | G | Total | Total | false |
| 2012 | S | Total | Total | false |
| 2012 | M | Total | Total | false |
| 2012 | F | Total | Total | true |
| 2012 | W | Total | Total | true |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
sc = DS 🟢 · any scalar → boolean
Scalar first and null measure 🟢 pandas ✅ · DuckDB ✅
- Tests:
2 = DS_1, a scalar as the left operand, where one measure value equals it and one is null.- Manual:
Equal to: “The operator returns true if the left is equal to right, false otherwise.” A null operand gives a null result, as in the output of the page’s Example 1; the User Manual says: “most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null”.
- Expected:
bool_var, the page’s measure for a data set result, is false, true, false and null for ids 1 to 4: 2 = 2 is true, and the null measure gives null.
DS_r := 2 = DS_1;
| Id_1 | Me_1 |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 |
| Id_1 | bool_var |
|---|---|
| 1 | false |
| 2 | true |
| 3 | false |
| 4 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
comp = comp 🟢 · any scalar → boolean
Two measures and null 🟢 pandas ✅ · DuckDB ✅
- Tests:
Me_1 = Me_2insidecalc: two measures of one data set, equal in one data point and with a nullMe_2in another.- Manual:
Equal to: “The operator returns true if the left is equal to right, false otherwise.” A null operand gives a null result, as in the output of the page’s Example 1; the User Manual says: “most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null”.
- Expected:
Me_3is a new boolean measure: false, true, false and null for ids 1 to 4; 2 = 2 is true, and id 4 compares 4 with a null;Me_1andMe_2are kept.
DS_r := DS_1 [ calc Me_3 := Me_1 = Me_2 ];
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 1 | 3 |
| 2 | 2 | 2 |
| 3 | 3 | 1 |
| 4 | 4 |
| Id_1 | Me_1 | Me_2 | Me_3 |
|---|---|---|---|
| 1 | 1 | 3 | false |
| 2 | 2 | 2 | true |
| 3 | 3 | 1 | false |
| 4 | 4 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
comp = sc 🟢 · any scalar → boolean
Manual example 2 🟢 pandas ✅ · DuckDB ✅
- Tests:
Me_1 = 0.08insidecalc, where the new measureMe_2takes the result.- Manual:
Equal to, Example 2, output verbatim: “The operator returns true if the left is equal to right, false otherwise.”
- Expected:
Me_2is true for F and W, false for G, S and M, and null for B, whoseMe_1is null;Me_1is kept.
DS_r := DS_1 [ calc Me_2 := Me_1 = 0.08 ];
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 |
|---|---|---|---|---|
| 2012 | B | Total | Total | |
| 2012 | G | Total | Total | 0.286 |
| 2012 | S | Total | Total | 0.064 |
| 2012 | M | Total | Total | 0.043 |
| 2012 | F | Total | Total | 0.08 |
| 2012 | W | Total | Total | 0.08 |
| Id_1 | Id_2 | Id_3 | Id_4 | Me_1 | Me_2 |
|---|---|---|---|---|---|
| 2012 | B | Total | Total | ||
| 2012 | G | Total | Total | 0.286 | false |
| 2012 | S | Total | Total | 0.064 | false |
| 2012 | M | Total | Total | 0.043 | false |
| 2012 | F | Total | Total | 0.08 | true |
| 2012 | W | Total | Total | 0.08 | true |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
sc = comp 🟢 · any scalar → boolean
Scalar first and null measure 🟢 pandas ✅ · DuckDB ✅
- Tests:
2 = Me_1insidecalc, a scalar as the left operand, where one measure value equals it and one is null.- Manual:
Equal to: “The operator returns true if the left is equal to right, false otherwise.” A null operand gives a null result, as in the output of the page’s Example 1; the User Manual says: “most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null”.
- Expected:
Me_2is a new boolean measure: false, true, false and null for ids 1 to 4; 2 = 2 is true, and the null measure gives null;Me_1is kept.
DS_r := DS_1 [ calc Me_2 := 2 = Me_1 ];
| Id_1 | Me_1 |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 |
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 1 | false |
| 2 | 2 | true |
| 3 | 3 | false |
| 4 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
sc = sc 🟢 · any scalar → boolean
Different numbers 🟢 pandas ✅ · DuckDB ✅
- Tests:
SC_1 = SC_2withSC_1= 5 andSC_2= 9: two different numbers.- Manual:
Equal to, semantics for scalar operations: “
5 = 9gives:false”.- Expected:
SC_r = false, a Boolean: 5 and 9 are different numbers.
SC_r := SC_1 = SC_2;
| SC_1 | SC_2 |
|---|---|
| 5 | 9 |
Name |
Type |
Value |
|---|---|---|
|
Boolean |
|
Files: script.vtl · input/scalars.csv · input/scalars.json · expected/scalars.json · example page ↗