← aggr operator page · clause/aggr/no_group/single_group_no_identifiers

Single group no identifiers 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

aggr Me_1 := sum ( Me_1 ) with no grouping clause.

Manual:

Aggregation: "If no grouping clause is specified, then all the input Data Points are aggregated in a single group and the clause returns a Data Set that contains a single Data Point and has no Identifiers."

Expected:

One data point with no identifiers: the Measure Me_1 (no role written, and Me_1 is a Measure of DS_1) = 2 + 5 + 3 = 10. It may be Integer or Number: Sum says "implementations may preserve the integer type for the resulting measure or component when all operand values are integer and the sum is computed in integer arithmetic".

script.vtl ⇩

DS_r := DS_1 [ aggr Me_1 := sum ( Me_1 ) ];

input/DS_1.csv ⇩

Id_1Id_2Me_1
1A2
1B5
2A3

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Me_1
10

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Me_1", "type": ["Integer", "Number"], "role": "Measure"}
      ]
    }
  ]
}