Floor · floor
---
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["Floor · floor<br/>🟢3"]:::ok
subgraph G_ds["Dataset"]
direction LR
v_ds["floor(DS)"]:::ok
end
subgraph G_comp["Component"]
direction LR
v_comp["floor(comp)"]:::ok
end
subgraph G_sc["Scalar"]
direction LR
v_sc["floor(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 number · Gives integer
Comes from · number — 44 operators in 6 blocks 🟢44
General purpose operators (2) 🟢2
String operators (3) 🟢3
Numeric operators (17) 🟢17
Time operators (9) 🟢9
Aggregate and Analytic operators (10) 🟢10
Data validation operators (3) 🟢3
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
Goes to · integer — 43 operators in 8 blocks 🟢43
General purpose operators (1) 🟢1
String operators (2) 🟢2
Numeric operators (17) 🟢17
Time operators (6) 🟢6
Hierarchical aggregation (1) 🟢1
Aggregate and Analytic operators (10) 🟢10
Data validation operators (2) 🟢2
Definitions (VTL-DL) (4) 🟢4
Goes to · operators that take any scalar — 46 operators in 8 blocks 🟢46
General purpose operators (6) 🟢6
Join operators (4) 🟢4
Comparison operators (11) 🟢11
Set operators (4) 🟢4
Aggregate and Analytic operators (8) 🟢8
Data validation operators (1) 🟢1
Conditional operators (3) 🟢3
Forms
floor(DS) 🟢 · number → integer
Manual example 1 🟢 pandas ✅ · DuckDB ✅
- Tests:
flooron every measure ofDS_1: Number measures become Integer measures with the same names.- Manual:
Floor, Example 1, output verbatim: “The operator floor returns the greatest integer which is smaller than or equal to op.”
- Expected:
Me_17.0, 0.1, -32.2 and 44.5 give 7, 0, -33 and 44;Me_25.9, -5.0, 17.7 and -0.3 give 5, -5, 17 and -1.
DS_r := floor ( DS_1 );
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 10 | A | 7.0 | 5.9 |
| 10 | B | 0.1 | -5.0 |
| 11 | A | -32.2 | 17.7 |
| 11 | B | 44.5 | -0.3 |
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 10 | A | 7 | 5 |
| 10 | B | 0 | -5 |
| 11 | A | -33 | 17 |
| 11 | B | 44 | -1 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
One number measure 🟢 pandas ✅ · DuckDB ✅
- Tests:
flooron a dataset with one Number measure, which becomes an Integer measure.- Manual:
Floor gives an Integer, and in the Typical behaviours, “Operators changing the data type”, the measure whose type changes is replaced: “A default generic Measure is assigned by default to the result Data Set, depending on the data type of the result”,
int_varfor an Integer.- Expected:
int_var, an Integer: 7.2, -3.7 and 5.0 give 7, -4 and 5. The page’s Example 1, on two Number measures, keeps their names.
DS_r := floor(DS_1);
| Id_1 | Me_1 |
|---|---|
| 1 | 7.2 |
| 2 | -3.7 |
| 3 | 5.0 |
| Id_1 | int_var |
|---|---|
| 1 | 7 |
| 2 | -4 |
| 3 | 5 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
floor(comp) 🟢 · number → integer
Manual example 2 🟢 pandas ✅ · DuckDB ✅
- Tests:
flooron a component insidecalc.- Manual:
Floor, Example 2, output verbatim: “The operator floor returns the greatest integer which is smaller than or equal to op.”
- Expected:
Me_10 = floor(Me_1)is an Integer: 7, 0, -33 and 44; the other components are kept.
DS_r := DS_1 [ calc Me_10 := floor (Me_1) ];
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 10 | A | 7.0 | 5.9 |
| 10 | B | 0.1 | -5.0 |
| 11 | A | -32.2 | 17.7 |
| 11 | B | 44.5 | -0.3 |
| Id_1 | Id_2 | Me_1 | Me_2 | Me_10 |
|---|---|---|---|---|
| 10 | A | 7.0 | 5.9 | 7 |
| 10 | B | 0.1 | -5.0 | 0 |
| 11 | A | -32.2 | 17.7 | -33 |
| 11 | B | 44.5 | -0.3 | 44 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
floor(sc) 🟢 · number → integer
Negative fraction 🟢 pandas ✅ · DuckDB ✅
- Tests:
floorof a negative fraction:floor(SC_1)withSC_1= -3.1415.- Manual:
Floor: “
floor( -3.1415 )gives-4”.- Expected:
SC_r = -4, an Integer: the greatest integer not above the operand, where a truncation would give -3.
SC_r := floor(SC_1);
| SC_1 |
|---|
| -3.1415 |
Name |
Type |
Value |
|---|---|---|
|
Integer |
|
Files: script.vtl · input/scalars.csv · input/scalars.json · expected/scalars.json · example page ↗