Logical conjunction · and

🟢 7 of 7 forms all ok · VTL 2.2 Reference Manual ↗ · vtlengine 1.10.0rc3 (9e1c81a6) · 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["Logical conjunction · and<br/>🟢7"]:::ok
    subgraph G_ds["Dataset"]
        direction LR
        v_ds_ds["DS and DS"]:::ok
        v_ds_sc["DS and sc"]:::ok
        v_sc_ds["sc and DS"]:::ok
    end
    subgraph G_comp["Component"]
        direction LR
        v_comp_comp["comp and comp"]:::ok
        v_comp_sc["comp and sc"]:::ok
        v_sc_comp["sc and comp"]:::ok
    end
    subgraph G_sc["Scalar"]
        direction LR
        v_sc_sc["sc and 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 boolean · Gives boolean

Viral attributes: combined with the propagation rules → Viral propagation

Comes from · boolean — 19 operators in 4 blocks 🟢19
General purpose operators (1) 🟢1
Comparison operators (12) 🟢12
Boolean operators (3) 🟢3
Data validation operators (3) 🟢3
Comes from · operators that return any type (their input's) — 38 operators in 8 blocks 🟢38
General purpose operators (6) 🟢6
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 · boolean — 26 operators in 8 blocks 🟢26
General purpose operators (1) 🟢1
Join operators (4) 🟢4
Boolean operators (3) 🟢3
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 — 38 operators in 8 blocks 🟢38
General purpose operators (6) 🟢6
Comparison operators (11) 🟢11
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 and DS 🟢 · boolean → boolean

Manual example 1 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1 and DS_2 on two data sets with the same identifiers and one boolean measure.

Manual:

Logical conjunction, Example 1, output verbatim: “The and operator returns true if both operands are true, otherwise false.”

Expected:

the page’s six data points: Me_1 is true only for (M, 65, B, 2013), where both operands are true.

script.vtl
DS_r:= DS_1 and DS_2;
Input DS_1
Id_1Id_2Id_3Id_4Me_1
M15B2013True
M64B2013False
M65B2013True
F15U2013False
F64U2013False
F65U2013True
Input DS_2
Id_1Id_2Id_3Id_4Me_1
M15B2013False
M64B2013True
M65B2013True
F15U2013True
F64U2013False
F65U2013False
Expected DS_r
Id_1Id_2Id_3Id_4Me_1
M15B2013false
M64B2013false
M65B2013true
F15U2013false
F64U2013false
F65U2013false

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 ↗

Null operands and uncoupled point 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1 and DS_2: each of the four shared data points has a null operand, on the left for ids 1 and 4 and on the right for ids 2 and 3, and DS_2 has an id 5 that DS_1 lacks.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern. “Data Points that are not coupled are left out (the inner join is used)” (Typical behaviours of the ML Operators).

Expected:

Me_1 is false, null, false and null for ids 1 to 4, and there is no data point for id 5. null and false is false and null and true is null: a null on the left is not listed on the page, and follows from the three-valued logic of the User Manual (“VTL adopts 3VL”).

script.vtl
DS_r := DS_1 and DS_2;
Input DS_1
Id_1Me_1
1
2true
3false
4
Input DS_2
Id_1Me_1
1false
2
3
4true
5true
Expected DS_r
Id_1Me_1
1false
2
3false
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 and sc 🟢 · boolean → boolean

True keeps the other operand 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1 and true: a data set with Me_1 true, false and null, and the boolean scalar true.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

Me_1 is true, false and null, as in DS_1: true leaves the other operand as it is, and null stays null. null and true is null: a null on the left is not listed on the page, and follows from the three-valued logic of the User Manual (“VTL adopts 3VL”).

script.vtl
DS_r := DS_1 and true;
Input DS_1
Id_1Me_1
1true
2false
3
Expected DS_r
Id_1Me_1
1true
2false
3

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

False decides even over null 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1 and false: a data set with Me_1 true, false and null, and the boolean scalar false.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

Me_1 is false on all three data points: false decides the result whatever the other operand is, null included. null and false is false: a null on the left is not listed on the page, and follows from the three-valued logic of the User Manual (“VTL adopts 3VL”).

script.vtl
DS_r := DS_1 and false;
Input DS_1
Id_1Me_1
1true
2false
3
Expected DS_r
Id_1Me_1
1false
2false
3false

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

sc and DS 🟢 · boolean → boolean

True keeps the other operand 🟢 pandas ✅ · DuckDB ✅
Tests:

true and DS_1: the boolean scalar true on the left, and a data set with Me_1 true, false and null.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

Me_1 is true, false and null, as in DS_1: true leaves the other operand as it is, and null stays null (true and null is null).

script.vtl
DS_r := true and DS_1;
Input DS_1
Id_1Me_1
1true
2false
3
Expected DS_r
Id_1Me_1
1true
2false
3

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

False decides even over null 🟢 pandas ✅ · DuckDB ✅
Tests:

false and DS_1: the boolean scalar false on the left, and a data set with Me_1 true, false and null.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

Me_1 is false on all three data points: false decides the result whatever the other operand is, null included (false and null is false).

script.vtl
DS_r := false and DS_1;
Input DS_1
Id_1Me_1
1true
2false
3
Expected DS_r
Id_1Me_1
1false
2false
3false

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

comp and comp 🟢 · boolean → boolean

All four boolean combinations 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1[calc Me_3 := Me_1 and Me_2]: ids 1 to 4 hold the four combinations of two boolean values.

Manual:

Logical conjunction: “The and operator returns true if both operands are true, otherwise false.”

Expected:

Me_3 is true only for id 1, where both operands are true, and false for ids 2 to 4.

script.vtl
DS_r := DS_1[calc Me_3 := Me_1 and Me_2];
Input DS_1
Id_1Me_1Me_2
1truetrue
2truefalse
3falsetrue
4falsefalse
Expected DS_r
Id_1Me_1Me_2Me_3
1truetruetrue
2truefalsefalse
3falsetruefalse
4falsefalsefalse

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

Null on either side 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1[calc Me_3 := Me_1 and Me_2] where every data point has a null operand, on the left for ids 1 and 4 and on the right for ids 2 and 3.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

Me_3 is false, null, false and null for ids 1 to 4. null and false is false and null and true is null: a null on the left is not listed on the page, and follows from the three-valued logic of the User Manual (“VTL adopts 3VL”).

script.vtl
DS_r := DS_1[calc Me_3 := Me_1 and Me_2];
Input DS_1
Id_1Me_1Me_2
1false
2true
3false
4true
Expected DS_r
Id_1Me_1Me_2Me_3
1falsefalse
2true
3falsefalse
4true

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

comp and sc 🟢 · boolean → boolean

Manual example 2 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1 [ calc Me_2 := Me_1 and true ]: a new measure from a component and the boolean scalar true.

Manual:

Logical conjunction, Example 2, output verbatim: “The and operator returns true if both operands are true, otherwise false.”

Expected:

the page’s six data points: Me_2 equals Me_1 on each one, as and true leaves the other operand as it is.

script.vtl
DS_r := DS_1 [ calc Me_2:= Me_1 and true ];
Input DS_1
Id_1Id_2Id_3Id_4Me_1
M15B2013True
M64B2013False
M65B2013True
F15U2013False
F64U2013False
F65U2013True
Expected DS_r
Id_1Id_2Id_3Id_4Me_1Me_2
M15B2013truetrue
M64B2013falsefalse
M65B2013truetrue
F15U2013falsefalse
F64U2013falsefalse
F65U2013truetrue

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

True keeps the other operand 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1[calc Me_2 := Me_1 and true]: a component Me_1 that is true, false and null, and the boolean scalar true.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

Me_2 is true, false and null, as in Me_1: true leaves the other operand as it is, and null stays null. null and true is null: a null on the left is not listed on the page, and follows from the three-valued logic of the User Manual (“VTL adopts 3VL”).

script.vtl
DS_r := DS_1[calc Me_2 := Me_1 and true];
Input DS_1
Id_1Me_1
1true
2false
3
Expected DS_r
Id_1Me_1Me_2
1truetrue
2falsefalse
3

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

False decides even over null 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1[calc Me_2 := Me_1 and false]: a component Me_1 that is true, false and null, and the boolean scalar false.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

Me_2 is false on all three data points: false decides the result whatever the other operand is, null included. null and false is false: a null on the left is not listed on the page, and follows from the three-valued logic of the User Manual (“VTL adopts 3VL”).

script.vtl
DS_r := DS_1[calc Me_2 := Me_1 and false];
Input DS_1
Id_1Me_1
1true
2false
3
Expected DS_r
Id_1Me_1Me_2
1truefalse
2falsefalse
3false

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

sc and comp 🟢 · boolean → boolean

True keeps the other operand 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1[calc Me_2 := true and Me_1]: the boolean scalar true on the left, and a component Me_1 that is true, false and null.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

Me_2 is true, false and null, as in Me_1: true leaves the other operand as it is, and null stays null (true and null is null).

script.vtl
DS_r := DS_1[calc Me_2 := true and Me_1];
Input DS_1
Id_1Me_1
1true
2false
3
Expected DS_r
Id_1Me_1Me_2
1truetrue
2falsefalse
3

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

False decides even over null 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1[calc Me_2 := false and Me_1]: the boolean scalar false on the left, and a component Me_1 that is true, false and null.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

Me_2 is false on all three data points: false decides the result whatever the other operand is, null included (false and null is false).

script.vtl
DS_r := DS_1[calc Me_2 := false and Me_1];
Input DS_1
Id_1Me_1
1true
2false
3
Expected DS_r
Id_1Me_1Me_2
1truefalse
2falsefalse
3false

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

sc and sc 🟢 · boolean → boolean

All four boolean combinations 🟢 pandas ✅ · DuckDB ✅
Tests:

the four combinations of two boolean scalars: SC_true and SC_true, SC_true and SC_false, SC_false and SC_true and SC_false and SC_false, with SC_true = true and SC_false = false.

Manual:

Logical conjunction: “The and operator returns true if both operands are true, otherwise false.”

Expected:

SC_1 is true and SC_2, SC_3 and SC_4 are false, all Booleans.

script.vtl
SC_1 := SC_true and SC_true;
SC_2 := SC_true and SC_false;
SC_3 := SC_false and SC_true;
SC_4 := SC_false and SC_false;
Input scalars
SC_trueSC_false
truefalse
Expected scalars

Name

Type

Value

SC_1

Boolean

"true"

SC_2

Boolean

"false"

SC_3

Boolean

"false"

SC_4

Boolean

"false"

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

One null operand on either side 🟢 pandas ✅ · DuckDB ✅
Tests:

one null operand, on the right or on the left: SC_true and SC_null, SC_null and SC_true, SC_false and SC_null and SC_null and SC_false, with SC_true = true, SC_null = null and SC_false = false.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

SC_1 and SC_2 are null, SC_3 and SC_4 are false, all Booleans. null and true and null and false, the cases of SC_2 and SC_4, are not listed on the page, and follow from the three-valued logic of the User Manual (“VTL adopts 3VL”).

script.vtl
SC_1 := SC_true and SC_null;
SC_2 := SC_null and SC_true;
SC_3 := SC_false and SC_null;
SC_4 := SC_null and SC_false;
Input scalars
SC_trueSC_nullSC_false
truefalse
Expected scalars

Name

Type

Value

SC_1

Boolean

null

SC_2

Boolean

null

SC_3

Boolean

"false"

SC_4

Boolean

"false"

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

Both operands null 🟢 pandas ✅ · DuckDB ✅
Tests:

SC_1 and SC_2 with both operands null: SC_1 and SC_2 are null Booleans.

Manual:

Logical conjunction: “false and null gives false”, “true and null gives null” and “null and null gives null”; the page’s sentence “returns true if both operands are true, otherwise false” conflicts with its null rows (true and null is null, not false), and the listed rows govern.

Expected:

SC_r is null, a Boolean, as in the row “null and null gives null”.

script.vtl
SC_r := SC_1 and SC_2;
Input scalars
SC_1SC_2
Expected scalars

Name

Type

Value

SC_r

Boolean

null

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