← analytic_invocation operator page · aggregate/analytic_invocation/window_default/ties_count_together

Ties count together 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

sum in calc, partitioned by Id_1 and ordered by Id_2, with no window clause, where (A, 1, x) and (A, 1, y) tie on Id_2.

Manual:

Analytic invocation: with an order clause and no window clause, the default is "range between unbounded preceding and current data point". sdmx-twg/vtl#694 made it the default window of SQL, whose range takes in the data points that tie with the current one on the order keys.

Expected:

in A (1 and 2 at Id_2 = 1, 3 at 2, 4 at 3), Me_2 is 1 + 2 = 3 on both tied data points, then 6 and 10; in B (5, 6), 5 and 11.

script.vtl ⇩

DS_r := DS_1 [ calc Me_2 := sum ( Me_1 over ( partition by Id_1 order by Id_2 ) ) ];

input/DS_1.csv ⇩

Id_1Id_2Id_3Me_1
A1x1
A1y2
A2x3
A3x4
B1x5
B2x6

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Id_1Id_2Id_3Me_1Me_2
A1x13
A1y23
A2x36
A3x410
B1x55
B2x611

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "String", "role": "Identifier"},
        {"name": "Id_2", "type": "Integer", "role": "Identifier"},
        {"name": "Id_3", "type": "String", "role": "Identifier"},
        {"name": "Me_1", "type": "Number", "role": "Measure"},
        {"name": "Me_2", "type": "Number", "role": "Measure"}
      ]
    }
  ]
}