← aggregate_invocation operator page · aggregate/aggregate_invocation/no_group/manual_ex_3

Manual example 3 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

avg with no grouping clause: the whole operand is one group.

Manual:

Aggregate invocation, Example 3, output verbatim: "If no grouping clause is specified, then all the input Data Points are aggregated in a single group and the operator returns a Data Set that contains a single Data Point and has no Identifiers."

Expected:

one data point with no identifiers: Me_1 = 155 / 10 = 15.5, a Number, and the non-viral At_1 is dropped.

script.vtl ⇩

DS_r := avg ( DS_1 );

input/DS_1.csv ⇩

Id_1Id_2Id_3Me_1At_1
2010EXX20
2010BXX1H
2010RXX1A
2010FYY23
2011EXX20P
2011BZZ1N
2011RYY-1P
2011FXX20Z
2012LZZ40P
2012EYY30P

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Me_1
15.5

expected/DS_r.json ⇩

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