← max operator page · aggregate/max/ds_group_by/string_measure

String measure 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

max over a String measure, grouped by Id_1.

Manual:

Maximum value: "For other comparable scalar types (for example time, string, boolean), the result has the same type as the operand".

Expected:

the greatest Strings, pear for A and plum for B; in A it is neither the first nor the last value in the order of Id_2. Strings compare character by character (the Greater than page gives false for "hello" > "hi"), and these words start with different letters: apple < fig < kiwi < pear and date < plum.

script.vtl ⇩

DS_r := max ( DS_1 group by Id_1 );

input/DS_1.csv ⇩

Id_1Id_2Me_1
A2020Q1kiwi
A2020Q2apple
A2021Q1pear
A2021Q2fig
B2020Q1plum
B2020Q2date

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Id_1Me_1
Apear
Bplum

expected/DS_r.json ⇩

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