Check · check

🟢 6 of 6 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
        ---
config:
  flowchart:
    useMaxWidth: false

---
flowchart LR
    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["Check · check<br/>🟢6"]:::ok
    v_bare["check(B)"]:::ok
    v_errorcode["check(B errorcode C)"]:::ok
    v_errorlevel["check(B errorlevel L)"]:::ok
    v_imbalance["check(B imbalance N)"]:::ok
    v_invalid["check(B invalid)"]:::ok
    v_all["check(B all)"]:::ok
    v_bare --- O
    v_errorcode --- O
    v_errorlevel --- O
    O --- v_imbalance
    O --- v_invalid
    O --- v_all
    click v_bare href "#form-bare"
    click v_errorcode href "#form-errorcode"
    click v_errorlevel href "#form-errorlevel"
    click v_imbalance href "#form-imbalance"
    click v_invalid href "#form-invalid"
    click v_all href "#form-all"
    

Types

Takes number, integer, string, boolean · Gives number, integer, string, boolean

Comes from · number, integer, string, boolean — 68 operators in 8 blocks 🟢68
General purpose operators (2) 🟢2
String operators (11) 🟢11
Numeric operators (18) 🟢18
Comparison operators (12) 🟢12
Boolean operators (4) 🟢4
Time operators (9) 🟢9
Aggregate and Analytic operators (10) 🟢10
Data validation operators (2) 🟢2
Comes from · operators that return any type (their input's) — 37 operators in 8 blocks 🟢37
General purpose operators (5) 🟢5
Join operators (4) 🟢4
Time operators (3) 🟢3
Set operators (4) 🟢4
Hierarchical aggregation (1) 🟢1
Aggregate and Analytic operators (8) 🟢8
Conditional operators (3) 🟢3
Clause operators (9) 🟢9
Goes to · number, integer, string, boolean — 68 operators in 13 blocks 🟢68
General purpose operators (1) 🟢1
Join operators (4) 🟢4
String operators (11) 🟢11
Numeric operators (18) 🟢18
Comparison operators (1) 🟢1
Boolean operators (4) 🟢4
Time operators (6) 🟢6
Hierarchical aggregation (1) 🟢1
Aggregate and Analytic operators (13) 🟢13
Data validation operators (1) 🟢1
Conditional operators (2) 🟢2
Clause operators (2) 🟢2
Definitions (VTL-DL) (4) 🟢4
Goes to · operators that take any scalar — 35 operators in 7 blocks 🟢35
General purpose operators (6) 🟢6
Comparison operators (11) 🟢11
Set operators (4) 🟢4
Aggregate and Analytic operators (5) 🟢5
Data validation operators (1) 🟢1
Conditional operators (1) 🟢1
Clause operators (7) 🟢7

Forms

check(B) 🟢 · boolean → boolean, number, string, integer

Every point returned by default 🟢 pandas ✅ · DuckDB ✅
Tests:

check ( DS_1 > 0 ) with no optional parameter, on Me_1 5, -3 and null, so bool_var is true, false and null.

Manual:

Check: “If not specified then output is all”, and “If not specified then imbalance is null”, and the same words hold for errorcode and errorlevel, the error code and level being “to be produced when the condition evaluates to false”.

Expected:

all three data points, bool_var true, false and null, with null imbalance, errorcode and errorlevel. imbalance is Number or Integer, its parameter’s number or a subtype, errorcode String and errorlevel Integer, “or integer if the errorcode_vd Value Domain is not found”.

script.vtl
DS_r := check ( DS_1 > 0 );
Input DS_1
Id_1Me_1
15
2-3
3
Expected DS_r
Id_1bool_varimbalanceerrorcodeerrorlevel
1true
2false
3

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

check(B errorcode C) 🟢 · string, boolean → boolean, number, string, integer

Code only on the false point 🟢 pandas ✅ · DuckDB ✅
Tests:

check ( DS_1 > 0 errorcode "E1" ) on Me_1 5, -3 and null, so bool_var is true, false and null.

Manual:

Check: errorcode is “the error code to be produced when the condition evaluates to false”, “or string if the errorcode_vd Value Domain is not found”, and “if the Measure bool_var is null then errorcode is null”.

Expected:

all three data points, by the default output all, with the String errorcode E1 on data point 2, the false one, and null on the true and the null ones. imbalance and errorlevel are null, as they are not specified: imbalance is Number or Integer, its parameter’s number or a subtype, and errorlevel Integer, “or integer if the errorcode_vd Value Domain is not found”.

script.vtl
DS_r := check ( DS_1 > 0 errorcode "E1" );
Input DS_1
Id_1Me_1
15
2-3
3
Expected DS_r
Id_1bool_varimbalanceerrorcodeerrorlevel
1true
2falseE1
3

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

check(B errorlevel L) 🟢 · integer, boolean → boolean, number, string, integer

Level only on the false point 🟢 pandas ✅ · DuckDB ✅
Tests:

check ( DS_1 > 0 errorlevel 5 ) on Me_1 5, -3 and null, so bool_var is true, false and null.

Manual:

Check: errorlevel is “the error level to be produced when the condition evaluates to false”, “or integer if the errorcode_vd Value Domain is not found”, and “if the Measure bool_var is null then errorlevel is null”.

Expected:

all three data points, by the default output all, with the Integer errorlevel 5 on data point 2, the false one, and null on the true and the null ones. imbalance and errorcode are null, as they are not specified: imbalance is Number or Integer, its parameter’s number or a subtype, and errorcode String.

script.vtl
DS_r := check ( DS_1 > 0 errorlevel 5 );
Input DS_1
Id_1Me_1
15
2-3
3
Expected DS_r
Id_1bool_varimbalanceerrorcodeerrorlevel
1true
2false5
3

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

check(B imbalance N) 🟢 · number, boolean → boolean, number, string, integer

Manual example 1 🟢 pandas ✅ · DuckDB ✅
Tests:

check ( DS_1 >= DS_2 imbalance DS_1 - DS_2 ) with no output, on two data sets of 12 data points.

Manual:

Check, Example 1, output verbatim: the result has “the Measure imbalance that contains the specified imbalance”, and “If not specified then output is all”.

Expected:

all 12 data points, bool_var being DS_1 >= DS_2 and imbalance DS_1 - DS_2: false with -8, -3, -25 and -15 on 2010 I, 2013 I, 2010 D and 2014 D, true with 5 on 2012 D, and true with 0 where the two are equal. errorcode and errorlevel are null, as none is given.

script.vtl
DS_r := check ( DS_1 >= DS_2 imbalance DS_1 - DS_2 );
Input DS_1
Id_1Id_2Me_1
2010I1
2011I2
2012I10
2013I4
2014I5
2015I6
2010D25
2011D35
2012D45
2013D55
2014D50
2015D75
Input DS_2
Id_1Id_2Me_1
2010I9
2011I2
2012I10
2013I7
2014I5
2015I6
2010D50
2011D35
2012D40
2013D55
2014D65
2015D75
Expected DS_r
Id_1Id_2bool_varimbalanceerrorcodeerrorlevel
2010Ifalse-8
2011Itrue0
2012Itrue0
2013Ifalse-3
2014Itrue0
2015Itrue0
2010Dfalse-25
2011Dtrue0
2012Dtrue5
2013Dtrue0
2014Dfalse-15
2015Dtrue0

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 ↗

check(B invalid) 🟢 · boolean → boolean, number, string, integer

Only the false point returned 🟢 pandas ✅ · DuckDB ✅
Tests:

check ( DS_1 > 0 invalid ) on Me_1 5, -3 and null, so bool_var is true, false and null.

Manual:

Check: “If output is invalid then only the Data Points where bool_var is false are returned”, and the result has “a boolean Measure named bool_var” with either output.

Expected:

data point 2 only, bool_var false, with null imbalance, errorcode and errorlevel, as none is specified: “If not specified then imbalance is null”, and the same words hold for errorcode and errorlevel, the error code and level being “to be produced when the condition evaluates to false”. imbalance is Number or Integer, its parameter’s number or a subtype, errorcode String and errorlevel Integer, “or integer if the errorcode_vd Value Domain is not found”.

script.vtl
DS_r := check ( DS_1 > 0 invalid );
Input DS_1
Id_1Me_1
15
2-3
3
Expected DS_r
Id_1bool_varimbalanceerrorcodeerrorlevel
2false

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

check(B all) 🟢 · boolean → boolean, number, string, integer

Explicit all same as default 🟢 pandas ✅ · DuckDB ✅
Tests:

check ( DS_1 > 0 all ), the default output written out, on Me_1 5, -3 and null, so bool_var is true, false and null.

Manual:

Check: “all returns all Data Points of op”, as with no output: “If not specified then output is all”; “If not specified then imbalance is null”, and the same words hold for errorcode and errorlevel, the error code and level being “to be produced when the condition evaluates to false”.

Expected:

the output of Every point returned by default, the bare form: all three data points, bool_var true, false and null, with null imbalance, errorcode and errorlevel. imbalance is Number or Integer, its parameter’s number or a subtype, errorcode String and errorlevel Integer, “or integer if the errorcode_vd Value Domain is not found”.

script.vtl
DS_r := check ( DS_1 > 0 all );
Input DS_1
Id_1Me_1
15
2-3
3
Expected DS_r
Id_1bool_varimbalanceerrorcodeerrorlevel
1true
2false
3

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