← trunc operator page · numeric/trunc/ds_no_digits/one_number_measure

One number measure 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

trunc with numDigit omitted, on a dataset with one Number measure.

Manual:

Truncation: "The basic scalar type of the result is integer if numDigit is omitted", 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_var for an Integer.

Expected:

int_var, an Integer: 3.14159, 2.71828 and 12345.6 give 3, 2 and 12345.

script.vtl ⇩

DS_r := trunc(DS_1);

input/DS_1.csv ⇩

Id_1Me_1
13.14159
22.71828
312345.6

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1int_var
13
22
312345

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "int_var", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}