Is null · isnull

🟢 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["Is null · isnull<br/>🟢3"]:::ok
    subgraph G_ds["Dataset"]
        direction LR
        v_ds["isnull(DS)"]:::ok
    end
    subgraph G_comp["Component"]
        direction LR
        v_comp["isnull(comp)"]:::ok
    end
    subgraph G_sc["Scalar"]
        direction LR
        v_sc["isnull(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 href "#form-ds"
    click v_comp href "#form-comp"
    click v_sc href "#form-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

isnull(DS) 🟢 · any scalar → boolean

Manual example 1 🟢 pandas ✅ · DuckDB ✅
Tests:

isnull(DS_1): the measure of DS_1, with two null values.

Manual:

Is null, Example 1, output verbatim: “The operator returns true if the value of the operand is null, false otherwise.”

Expected:

bool_var is true for S and W, whose measure is null, and false for B, G, M and F.

script.vtl
DS_r := isnull(DS_1);
Input DS_1
Id_1Id_2Id_3Id_4Me_1
2012BTotalTotal11094850
2012GTotalTotal11123034
2012STotalTotal
2012MTotalTotal46818219
2012FTotalTotal5401267
2012WTotalTotal
Expected DS_r
Id_1Id_2Id_3Id_4bool_var
2012BTotalTotalfalse
2012GTotalTotalfalse
2012STotalTotaltrue
2012MTotalTotalfalse
2012FTotalTotalfalse
2012WTotalTotaltrue

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

isnull(comp) 🟢 · any scalar → boolean

Manual example 2 🟢 pandas ✅ · DuckDB ✅
Tests:

isnull(Me_1) inside calc, where the new measure Me_2 takes the result.

Manual:

Is null, Example 2, output verbatim: “The operator returns true if the value of the operand is null, false otherwise.”

Expected:

Me_2 is true for S and W, whose Me_1 is null, and false for B, G, M and F; Me_1 is kept.

script.vtl
DS_r := DS_1[ calc Me_2 := isnull(Me_1) ];
Input DS_1
Id_1Id_2Id_3Id_4Me_1
2012BTotalTotal11094850
2012GTotalTotal11123034
2012STotalTotal
2012MTotalTotal46818219
2012FTotalTotal5401267
2012WTotalTotal
Expected DS_r
Id_1Id_2Id_3Id_4Me_1Me_2
2012BTotalTotal11094850false
2012GTotalTotal11123034false
2012STotalTotaltrue
2012MTotalTotal46818219false
2012FTotalTotal5401267false
2012WTotalTotaltrue

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

isnull(sc) 🟢 · any scalar → boolean

Null literal 🟢 pandas ✅ · DuckDB ✅
Tests:

isnull(null): the null literal.

Manual:

Is null, semantics for scalar operations: “isnull(null) gives true”.

Expected:

SC_r = true, a Boolean: the operand is null.

script.vtl
SC_r := isnull(null);
Expected scalars

Name

Type

Value

SC_r

Boolean

true

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

Non null string 🟢 pandas ✅ · DuckDB ✅
Tests:

isnull(SC_1) with SC_1 = "Hello": a string that is not null.

Manual:

Is null, semantics for scalar operations: “isnull("Hello") gives false”.

Expected:

SC_r = false, a Boolean: the operand is not null.

script.vtl
SC_r := isnull(SC_1);
Input scalars
SC_1
Hello
Expected scalars

Name

Type

Value

SC_r

Boolean

false

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