Change of Component name · rename

🟢 2 of 2 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
        ---
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["Change of Component name · rename<br/>🟢2"]:::ok
    v_basic["DS#91;rename comp to comp#93;"]:::ok
    v_multiple["DS#91;rename comp to comp, comp to 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
    v_multiple --- 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 v_multiple href "#form-multiple"
    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[rename comp to comp] 🟢 · any scalar → any type

Measure renamed 🟢 pandas ✅ · DuckDB ✅
Tests:

rename Me_1 to Me_2: one measure renamed.

Manual:

Change of Component name: “Only the Component name is changed and not the Component Values”.

Expected:

Me_2 is a Measure of type Integer, with the values of Me_1: 10 and 20.

script.vtl
DS_r := DS_1 [ rename Me_1 to Me_2 ];
Input DS_1
Id_1Me_1
110
220
Expected DS_r
Id_1Me_2
110
220

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

Identifier renamed 🟢 pandas ✅ · DuckDB ✅
Tests:

rename Id_2 to Id_3: an identifier renamed, where Manual example 1 of the multiple form renames a measure and an attribute.

Manual:

Change of Component name: “The operator assigns new names to one or more Components (Identifier, Measure or Attribute Components).”

Expected:

Id_3 stays an Identifier of type String, with the values of Id_2: A and B.

script.vtl
DS_r := DS_1 [ rename Id_2 to Id_3 ];
Input DS_1
Id_1Id_2Me_1
1A10
1B20
Expected DS_r
Id_1Id_3Me_1
1A10
1B20

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

New name already in operand 🟢 pandas ✅ · DuckDB ✅
Tests:

rename Me_1 to Me_2, on a data set that already has the measure Me_2: the first error condition that the page states.

Manual:

Change of Component name: “the component used in the dsc_to cannot have the same names as other Components of the result Data Set”.

Expected:

The error 1-1-6-8, “Cannot use component {comp_name} for rename, it is already in the Dataset {dataset_name}.”, for “The resulting Data Set, after renaming the specified Components, must have unique names of all its Components (otherwise a runtime error is raised)”: the result would have two components named Me_2. The page calls it a runtime error, but a name clash is a condition on the structures alone, so vtlengine raises it as a SemanticError and no 2-* message states it.

script.vtl
DS_r := DS_1 [ rename Me_1 to Me_2 ];
Input DS_1
Id_1Me_1Me_2
110100
220200

Expected error 1-1-6-8: Cannot use component {comp_name} for rename, it is already in the Dataset {dataset_name}.

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

DS[rename comp to comp, comp to comp] 🟢 · any scalar → any type

Manual example 1 🟢 pandas ✅ · DuckDB ✅
Tests:

rename Me_1 to Me_2, At_1 to At_2: a measure and an attribute renamed in one clause.

Manual:

Change of Component name, Example 1, output verbatim: “The operator assigns new names to one or more Components (Identifier, Measure or Attribute Components)”, and “Only the Component name is changed and not the Component Values”.

Expected:

The same data points, with Me_2 and At_2 in place of Me_1 and At_1, with their roles and types.

script.vtl
DS_r := DS_1 [ rename Me_1 to Me_2, At_1 to At_2];
Input DS_1
Id_1Id_2Id_3Me_1At_1
1BXX20F
1BYY1F
2AXX4E
2AYY9F
Expected DS_r
Id_1Id_2Id_3Me_2At_2
1BXX20F
1BYY1F
2AXX4E
2AYY9F

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