Maintaining Components · keep

🟢 1 of 1 form 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["Maintaining Components · keep<br/>🟢1"]:::ok
    v_basic["DS#91;keep comp#93;"]:::ok
    subgraph G_use["Used with"]
        direction LR
        used__join__inner_join["inner_join ↗<br/><small>used by</small>"]:::ext
        used__join__left_join["left_join ↗<br/><small>used by</small>"]:::ext
        used__join__full_join["full_join ↗<br/><small>used by</small>"]:::ext
        used__join__cross_join["cross_join ↗<br/><small>used by</small>"]:::ext
    end
    v_basic --- O
    O -.- G_use
    style G_use fill:#ffffff,stroke:#868e96,stroke-width:1px,stroke-dasharray: 1 4
    click v_basic href "#form-basic"
    click used__join__inner_join href "../join/inner_join.html" "Inner Join · inner_join"
    click used__join__left_join href "../join/left_join.html" "Left Join · left_join"
    click used__join__full_join href "../join/full_join.html" "Full Join · full_join"
    click used__join__cross_join href "../join/cross_join.html" "Cross Join · cross_join"
    

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[keep comp] 🟢 · any scalar → any type

Manual example 1 🟢 pandas ✅ · DuckDB ✅
Tests:

keep Me_1, on a data set with the measures Me_1 and Me_2 and the attribute At_1.

Manual:

Maintaining Components, Example 1, output verbatim: “The operator maintains the specified Components, drops all the other dependent Components of the Data Set (Measures and Attributes) and maintains the independent Components (Identifiers) unchanged.”

Expected:

The three identifiers and Me_1, on the same data points; Me_2 and At_1 are dropped.

script.vtl
DS_r := DS_1 [ keep Me_1 ];
Input DS_1
Id_1Id_2Id_3Me_1Me_2At_1
2010AXX2036E
2010AYY49F
2010BXX910F
Expected DS_r
Id_1Id_2Id_3Me_1
2010AXX20
2010AYY4
2010BXX9

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