/ Check-in [cebe09e1]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix problems with RANGE windows and string, blob and NULL values.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | window-functions
Files: files | file ages | folders
SHA3-256: cebe09e11cc91d9776f259dd9b87e9c760a460f53ba6fa36481dfe58f77ad417
User & Date: dan 2019-03-16 20:29:54
Wiki:window-functions
Context
2019-03-18
16:51
Fixes for RANGE windows and NULL values. check-in: 723c84be user: dan tags: window-functions
2019-03-16
20:29
Fix problems with RANGE windows and string, blob and NULL values. check-in: cebe09e1 user: dan tags: window-functions
10:15
In order to identify the first row of each partition, check if the rowid in the ephemeral table is 1 instead of using a dedicated flag register. check-in: f2d5f7a2 user: dan tags: window-functions
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/parse.y.

1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
frame_bound_e(A) ::= UNBOUNDED FOLLOWING. {A.eType = TK_UNBOUNDED; A.pExpr = 0;}

frame_bound(A) ::= expr(X) PRECEDING.   { A.eType = TK_PRECEDING; A.pExpr = X; }
frame_bound(A) ::= CURRENT ROW.         { A.eType = TK_CURRENT  ; A.pExpr = 0; }
frame_bound(A) ::= expr(X) FOLLOWING.   { A.eType = TK_FOLLOWING; A.pExpr = X; }

%type frame_exclude_opt {u8}
frame_exclude_opt(A) ::= . { A = TK_NO; }
frame_exclude_opt(A) ::= EXCLUDE frame_exclude(X). { A = X; }

%type frame_exclude {u8}
frame_exclude(A) ::= NO OTHERS.   { A = 0; }
frame_exclude(A) ::= CURRENT ROW. { A = TK_CURRENT; }
frame_exclude(A) ::= GROUP.       { A = TK_GROUP; }
frame_exclude(A) ::= TIES.        { A = TK_TIES; }







|







1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
frame_bound_e(A) ::= UNBOUNDED FOLLOWING. {A.eType = TK_UNBOUNDED; A.pExpr = 0;}

frame_bound(A) ::= expr(X) PRECEDING.   { A.eType = TK_PRECEDING; A.pExpr = X; }
frame_bound(A) ::= CURRENT ROW.         { A.eType = TK_CURRENT  ; A.pExpr = 0; }
frame_bound(A) ::= expr(X) FOLLOWING.   { A.eType = TK_FOLLOWING; A.pExpr = X; }

%type frame_exclude_opt {u8}
frame_exclude_opt(A) ::= . { A = 0; }
frame_exclude_opt(A) ::= EXCLUDE frame_exclude(X). { A = X; }

%type frame_exclude {u8}
frame_exclude(A) ::= NO OTHERS.   { A = 0; }
frame_exclude(A) ::= CURRENT ROW. { A = TK_CURRENT; }
frame_exclude(A) ::= GROUP.       { A = TK_GROUP; }
frame_exclude(A) ::= TIES.        { A = TK_TIES; }

Changes to src/window.c.

1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
....
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749



1750
1751
1752
1753
1754
1755
1756
....
1757
1758
1759
1760
1761
1762
1763




1764
1765
1766
1767
1768
1769
1770
....
1771
1772
1773
1774
1775
1776
1777




1778


1779


1780
1781




1782

1783
1784
1785
1786
1787
1788
1789
  pWin->eType = eType;
  pWin->eStart = eStart;
  pWin->eEnd = eEnd;
  pWin->eExclude = eExclude;
  pWin->bImplicitFrame = bImplicitFrame;
  pWin->pEnd = sqlite3WindowOffsetExpr(pParse, pEnd);
  pWin->pStart = sqlite3WindowOffsetExpr(pParse, pStart);
  /* pWin->eExclude = 1; */
  return pWin;

windowAllocErr:
  sqlite3ExprDelete(pParse->db, pEnd);
  sqlite3ExprDelete(pParse->db, pStart);
  return 0;
}
................................................................................
  }else{
    sqlite3VdbeAddOp2(v, OP_Goto, 0, addr);
  }
}

/*
** This function is called as part of generating VM programs for RANGE
** offset PRECEDING/FOLLOWING frame boundaries. It generates code equivalent
** to:
**
**   if( csr1.peerVal + regVal >= csr2.peerVal ) goto lbl;
**   if( csr1.rowid >= csr2.rowid ) goto lbl;



*/
static void windowCodeRangeTest(
  WindowCodeArg *p, 
  int op,                          /* OP_Ge or OP_Gt */
  int csr1, 
  int regVal, 
  int csr2,
................................................................................
  int lbl
){
  Parse *pParse = p->pParse;
  Vdbe *v = sqlite3GetVdbe(pParse);
  int reg1 = sqlite3GetTempReg(pParse);
  int reg2 = sqlite3GetTempReg(pParse);
  int arith = OP_Add;





  assert( op==OP_Ge || op==OP_Gt || op==OP_Le );
  assert( p->pMWin->pOrderBy && p->pMWin->pOrderBy->nExpr==1 );
  if( p->pMWin->pOrderBy->a[0].sortOrder ){
    switch( op ){
      case OP_Ge: op = OP_Le; break;
      case OP_Gt: op = OP_Lt; break;
................................................................................
      default: assert( op==OP_Le ); op = OP_Ge; break;
    }
    arith = OP_Subtract;
  }

  windowReadPeerValues(p, csr1, reg1);
  windowReadPeerValues(p, csr2, reg2);




  sqlite3VdbeAddOp3(v, arith, regVal, reg1, reg1);


  sqlite3VdbeAddOp3(v, op, reg2, lbl, reg1);


  sqlite3VdbeAddOp2(v, OP_Rowid, csr1, reg1);
  sqlite3VdbeAddOp2(v, OP_Rowid, csr2, reg2);




  sqlite3VdbeAddOp3(v, OP_Gt, reg2, lbl, reg1);

  sqlite3ReleaseTempReg(pParse, reg1);
  sqlite3ReleaseTempReg(pParse, reg2);
}

static int windowCodeOp(
 WindowCodeArg *p,
 int op,







<







 







|
|


|
>
>
>







 







>
>
>
>







 







>
>
>
>
|
>
>
|
>
>
|
|
>
>
>
>
|
>







1072
1073
1074
1075
1076
1077
1078

1079
1080
1081
1082
1083
1084
1085
....
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
....
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
....
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
  pWin->eType = eType;
  pWin->eStart = eStart;
  pWin->eEnd = eEnd;
  pWin->eExclude = eExclude;
  pWin->bImplicitFrame = bImplicitFrame;
  pWin->pEnd = sqlite3WindowOffsetExpr(pParse, pEnd);
  pWin->pStart = sqlite3WindowOffsetExpr(pParse, pStart);

  return pWin;

windowAllocErr:
  sqlite3ExprDelete(pParse->db, pEnd);
  sqlite3ExprDelete(pParse->db, pStart);
  return 0;
}
................................................................................
  }else{
    sqlite3VdbeAddOp2(v, OP_Goto, 0, addr);
  }
}

/*
** This function is called as part of generating VM programs for RANGE
** offset PRECEDING/FOLLOWING frame boundaries. Assuming "ASC" order for
** the ORDER BY term in the window, it generates code equivalent to:
**
**   if( csr1.peerVal + regVal >= csr2.peerVal ) goto lbl;
**
** A special type of arithmetic is used such that if csr.peerVal is not
** a numeric type (real or integer), then the result of the addition is
** a copy of csr1.peerVal.
*/
static void windowCodeRangeTest(
  WindowCodeArg *p, 
  int op,                          /* OP_Ge or OP_Gt */
  int csr1, 
  int regVal, 
  int csr2,
................................................................................
  int lbl
){
  Parse *pParse = p->pParse;
  Vdbe *v = sqlite3GetVdbe(pParse);
  int reg1 = sqlite3GetTempReg(pParse);
  int reg2 = sqlite3GetTempReg(pParse);
  int arith = OP_Add;
  int addrGe;
  int addrNotNull;

  int regString = ++pParse->nMem;

  assert( op==OP_Ge || op==OP_Gt || op==OP_Le );
  assert( p->pMWin->pOrderBy && p->pMWin->pOrderBy->nExpr==1 );
  if( p->pMWin->pOrderBy->a[0].sortOrder ){
    switch( op ){
      case OP_Ge: op = OP_Le; break;
      case OP_Gt: op = OP_Lt; break;
................................................................................
      default: assert( op==OP_Le ); op = OP_Ge; break;
    }
    arith = OP_Subtract;
  }

  windowReadPeerValues(p, csr1, reg1);
  windowReadPeerValues(p, csr2, reg2);

  /* Check if the peer value for csr1 value is a text or blob by comparing
  ** it to the smallest possible string - ''. */
  sqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC);
  addrGe = sqlite3VdbeAddOp3(v, OP_Ge, regString, 0, reg1);

  if( op==OP_Le ){
    sqlite3VdbeAddOp2(v, OP_IsNull, reg1, lbl);
  }
  if( op==OP_Ge ){
    sqlite3VdbeAddOp2(v, OP_NotNull, reg1, sqlite3VdbeCurrentAddr(v)+2);
    sqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl);
  }

  sqlite3VdbeAddOp3(v, arith, regVal, reg1, reg1);
  sqlite3VdbeJumpHere(v, addrGe);
  sqlite3VdbeAddOp3(v, op, reg2, lbl, reg1);

  sqlite3ReleaseTempReg(pParse, reg1);
  sqlite3ReleaseTempReg(pParse, reg2);
}

static int windowCodeOp(
 WindowCodeArg *p,
 int op,

Changes to test/pg_common.tcl.

36
37
38
39
40
41
42

43
44
45
46

47
48
49




50

51

52


53
54
55
56
57
58
59
60
  }
  if {$frag != ""} {
    lappend lSql $frag
  }
  #puts $lSql

  set ret ""

  foreach stmt $lSql {
    set res [pg_exec $::db $stmt]
    set err [pg_result $res -error]
    if {$err!=""} { error $err }

    for {set i 0} {$i < [pg_result $res -numTuples]} {incr i} {
      if {$i==0} {
        set ret [pg_result $res -getTuple 0]




      } else {

        append ret "   [pg_result $res -getTuple $i]"

      }


      # lappend ret {*}[pg_result $res -getTuple $i]
    }
    pg_result $res -clear
  }

  set ret
}








>




>

<
|
>
>
>
>

>
|
>
|
>
>
|







36
37
38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  }
  if {$frag != ""} {
    lappend lSql $frag
  }
  #puts $lSql

  set ret ""
  set nChar 0
  foreach stmt $lSql {
    set res [pg_exec $::db $stmt]
    set err [pg_result $res -error]
    if {$err!=""} { error $err }

    for {set i 0} {$i < [pg_result $res -numTuples]} {incr i} {

      set t [pg_result $res -getTuple $i]
      set nNew [string length $t]
      if {$nChar>0 && ($nChar+$nNew+3)>75} {
        append ret "\n  "
        set nChar 0
      } else {
        if {$nChar>0} {
          append ret "   "
          incr nChar 3
        }
      }
      incr nChar $nNew
      append ret $t
    }
    pg_result $res -clear
  }

  set ret
}

Changes to test/window1.test.

845
846
847
848
849
850
851











































































852


  WINDOW win1 AS (PARTITION BY b),
         win2 AS (win1),
         win3 AS (win2),
         win4 AS (win3),
         win5 AS (win4 ORDER BY c)
} {four four.six four.six.two five five.one five.one.three}












































































finish_test









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
  WINDOW win1 AS (PARTITION BY b),
         win2 AS (win1),
         win3 AS (win2),
         win4 AS (win3),
         win5 AS (win4 ORDER BY c)
} {four four.six four.six.two five five.one five.one.three}

#-------------------------------------------------------------------------
# Test RANGE <expr> PRECEDING/FOLLOWING when there are string, blob
# and NULL values in the dataset.
#
reset_db
do_execsql_test 19.0 {
  CREATE TABLE t1(a, b);
  INSERT INTO t1 VALUES
    (1, 1), (2, 2), (3, 3), (4, 4), (5, 5),
    ('a', 6), ('b', 7), ('c', 8), ('d', 9), ('e', 10);
}
do_execsql_test 19.1 {
  SELECT a, sum(b) OVER (ORDER BY a) FROM t1;
} {1 1  2 3  3 6  4 10  5 15  a 21 b 28 c 36 d 45 e 55}

do_execsql_test 19.2.1 {
  SELECT a, sum(b) OVER (
    ORDER BY a RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING
  ) FROM t1;
} {1 3 2 6 3 9 4 12 5 9 a 6 b 7 c 8 d 9 e 10}
do_execsql_test 19.2.2 {
  SELECT a, sum(b) OVER (
    ORDER BY a DESC RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING
  ) FROM t1 ORDER BY a ASC;
} {1 3 2 6 3 9 4 12 5 9 a 6 b 7 c 8 d 9 e 10}

do_execsql_test 19.3.1 {
  SELECT a, sum(b) OVER (
    ORDER BY a RANGE BETWEEN 2 PRECEDING AND 1 FOLLOWING
  ) FROM t1;
} {1 3 2 6 3 10 4 14 5 12 a 6 b 7 c 8 d 9 e 10}
do_execsql_test 19.3.2 {
  SELECT a, sum(b) OVER (
    ORDER BY a DESC RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING
  ) FROM t1 ORDER BY a ASC;
} {1 3 2 6 3 10 4 14 5 12 a 6 b 7 c 8 d 9 e 10}


reset_db
do_execsql_test 20.0 {
  CREATE TABLE t1(a, b);
  INSERT INTO t1 VALUES
    (NULL, 100), (NULL, 100), 
    (1, 1), (2, 2), (3, 3), (4, 4), (5, 5),
    ('a', 6), ('b', 7), ('c', 8), ('d', 9), ('e', 10);
}
do_execsql_test 20.1 {
  SELECT a, sum(b) OVER (ORDER BY a) FROM t1;
} {
  {} 200 {} 200 1 201  2 203  3 206  4 210  5 215  
  a 221 b 228 c 236 d 245 e 255
}

do_execsql_test 20.2.1 {
  SELECT a, sum(b) OVER (
    ORDER BY a RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING
  ) FROM t1;
} {{} 200 {} 200 1 3 2 6 3 9 4 12 5 9 a 6 b 7 c 8 d 9 e 10}
do_execsql_test 20.2.2 {
  SELECT a, sum(b) OVER (
    ORDER BY a DESC RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING
  ) FROM t1 ORDER BY a ASC;
} {{} 200 {} 200 1 3 2 6 3 9 4 12 5 9 a 6 b 7 c 8 d 9 e 10}

do_execsql_test 20.3.1 {
  SELECT a, sum(b) OVER (
    ORDER BY a RANGE BETWEEN 2 PRECEDING AND 1 FOLLOWING
  ) FROM t1;
} {{} 200 {} 200 1 3 2 6 3 10 4 14 5 12 a 6 b 7 c 8 d 9 e 10}
do_execsql_test 20.3.2 {
  SELECT a, sum(b) OVER (
    ORDER BY a DESC RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING
  ) FROM t1 ORDER BY a ASC;
} {{} 200 {} 200 1 3 2 6 3 10 4 14 5 12 a 6 b 7 c 8 d 9 e 10}

finish_test


Changes to test/window8.tcl.

118
119
120
121
122
123
124








125
126
127
128
129
130
131
...
150
151
152
153
154
155
156














157
158
159
160
    SELECT nth_value(c, 14) OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING $ex
    )
  "








}

==========

execsql_test 3.0 {
  DROP TABLE IF EXISTS t1;
  CREATE TABLE t1(a REAL, b INTEGER);
................................................................................
  12 { ORDER BY a DESC RANGE BETWEEN 2.1 FOLLOWING AND UNBOUNDED FOLLOWING }
} {
  execsql_test 3.$tn "
    SELECT CAST(a AS INTEGER), sum(b) OVER win FROM t1 WINDOW win AS ($frame)
  "
}
















finish_test









>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>




118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
...
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    SELECT nth_value(c, 14) OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING $ex
    )
  "

  execsql_test 2.$tn.3 "
    SELECT min(c) OVER win, max(c) OVER win, sum(c) OVER win FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW $ex
    ) ORDER BY a, b, c;
  "
}

==========

execsql_test 3.0 {
  DROP TABLE IF EXISTS t1;
  CREATE TABLE t1(a REAL, b INTEGER);
................................................................................
  12 { ORDER BY a DESC RANGE BETWEEN 2.1 FOLLOWING AND UNBOUNDED FOLLOWING }
} {
  execsql_test 3.$tn "
    SELECT CAST(a AS INTEGER), sum(b) OVER win FROM t1 WINDOW win AS ($frame)
  "
}

==========

execsql_test 4.0 {
  DROP TABLE IF EXISTS t1;
  CREATE TABLE t1(a INTEGER, b INTEGER);
  INSERT INTO t1 VALUES
    (NULL, 1), (NULL, 2), (NULL, 3), (10, 4), (10, 5);
}

execsql_test 4.1 {
  SELECT sum(b) OVER (
    ORDER BY a RANGE BETWEEN 5 PRECEDING AND 10 FOLLOWING
  ) FROM t1 ORDER BY 1;
}

finish_test


Changes to test/window8.test.

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































587
588
589
590
591
592
593
594
595





596
597
598
599
600
601
602
603
604






























605
606
607
608
609
610
611
612
613





614
615
616
617
618
619
620
621
622






























623
624
625
626
627
628
629
630
631





632
633
634
635
636
637
638
639
640






























641
642
643
644
645
646
647
648
649





650
651
652
653
654
655
656
657
658






























659
660
661
662
663
664
665
...
710
711
712
713
714
715
716
717















718
    ('HH', 'bb', 133), ('EE', 'bb', 252), ('II', 'bb', 805), 
    ('BB', 'bb', 786), ('EE', 'bb', 768), ('HH', 'bb', 683), 
    ('DD', 'bb', 238), ('DD', 'aa', 256);
} {}

do_execsql_test 1.1.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025   CC bb 12025   CC bb 12025   DD aa 15147   DD aa 15147   DD aa 15147   DD bb 15147   DD bb 15147   DD bb 15147   DD bb 15147   EE aa 19179   EE aa 19179   EE bb 19179   EE bb 19179   EE bb 19179   FF aa 21718   FF aa 21718   FF aa 21718   FF aa 21718   FF bb 21718   FF bb 21718   FF bb 21718   FF bb 21718   FF bb 21718   FF bb 21718   GG aa 27386   GG aa 27386   GG aa 27386   GG aa 27386   GG bb 27386   GG bb 27386   GG bb 27386   GG bb 27386   HH aa 31854   HH aa 31854   HH aa 31854   HH bb 31854   HH bb 31854   HH bb 31854   HH bb 31854   HH bb 31854   HH bb 31854   II aa 37297   II aa 37297   II bb 37297   II bb 37297   II bb 37297   II bb 37297   II bb 37297   JJ aa 40937   JJ aa 40937   JJ aa 40937   JJ aa 40937   JJ bb 40937   JJ bb 40937   JJ bb 40937   JJ bb 40937}

do_execsql_test 1.1.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307   AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025   CC bb 13979   CC bb 13979   DD aa 15147   DD aa 15147   DD aa 15147   DD bb 16472   DD bb 16472   DD bb 16472   DD bb 16472   EE aa 19179   EE aa 19179   EE bb 20069   EE bb 20069   EE bb 20069   FF aa 21718   FF aa 21718   FF aa 21718   FF aa 21718   FF bb 23881   FF bb 23881   FF bb 23881   FF bb 23881   FF bb 23881   FF bb 23881   GG aa 27386   GG aa 27386   GG aa 27386   GG aa 27386   GG bb 28983   GG bb 28983   GG bb 28983   GG bb 28983   HH aa 31854   HH aa 31854   HH aa 31854   HH bb 34103   HH bb 34103   HH bb 34103   HH bb 34103   HH bb 34103   HH bb 34103   II aa 37297   II aa 37297   II bb 38347   II bb 38347   II bb 38347   II bb 38347   II bb 38347   JJ aa 40937   JJ aa 40937   JJ aa 40937   JJ aa 40937   JJ bb 42951   JJ bb 42951   JJ bb 42951   JJ bb 42951}

do_execsql_test 1.1.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.1.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 934   AA bb 934   AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   CC aa 934   CC aa 934   CC aa 934   CC aa 934   CC bb 934   CC bb 934   DD aa 934   DD aa 934   DD aa 934   DD bb 934   DD bb 934   DD bb 934   DD bb 934   EE aa 959   EE aa 959   EE bb 959   EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   GG aa 959   GG aa 959   GG aa 959   GG aa 959   GG bb 959   GG bb 959   GG bb 959   GG bb 959   HH aa 959   HH aa 959   HH aa 959   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979   II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ bb 979   JJ bb 979   JJ bb 979   JJ bb 979}

do_execsql_test 1.1.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 223   AA bb 223   AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   CC aa 223   CC aa 223   CC aa 223   CC aa 223   CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 158   DD bb 158   DD bb 158   DD bb 158   EE aa 158   EE aa 158   EE bb 113   EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102   GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   II aa 102   II aa 102   II bb 102   II bb 102   II bb 102   II bb 102   II bb 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ bb 102   JJ bb 102   JJ bb 102   JJ bb 102}

do_execsql_test 1.1.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025   CC bb 12025   CC bb 12025   DD aa 15147   DD aa 15147   DD aa 15147   DD bb 15147   DD bb 15147   DD bb 15147   DD bb 15147   EE aa 19179   EE aa 19179   EE bb 19179   EE bb 19179   EE bb 19179   FF aa 21718   FF aa 21718   FF aa 21718   FF aa 21718   FF bb 21718   FF bb 21718   FF bb 21718   FF bb 21718   FF bb 21718   FF bb 21718   GG aa 27386   GG aa 27386   GG aa 27386   GG aa 27386   GG bb 27386   GG bb 27386   GG bb 27386   GG bb 27386   HH aa 31854   HH aa 31854   HH aa 31854   HH bb 31854   HH bb 31854   HH bb 31854   HH bb 31854   HH bb 31854   HH bb 31854   II aa 37297   II aa 37297   II bb 37297   II bb 37297   II bb 37297   II bb 37297   II bb 37297   JJ aa 40937   JJ aa 40937   JJ aa 40937   JJ aa 40937   JJ bb 40937   JJ bb 40937   JJ bb 40937   JJ bb 40937}

do_execsql_test 1.1.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307   AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025   CC bb 13979   CC bb 13979   DD aa 15147   DD aa 15147   DD aa 15147   DD bb 16472   DD bb 16472   DD bb 16472   DD bb 16472   EE aa 19179   EE aa 19179   EE bb 20069   EE bb 20069   EE bb 20069   FF aa 21718   FF aa 21718   FF aa 21718   FF aa 21718   FF bb 23881   FF bb 23881   FF bb 23881   FF bb 23881   FF bb 23881   FF bb 23881   GG aa 27386   GG aa 27386   GG aa 27386   GG aa 27386   GG bb 28983   GG bb 28983   GG bb 28983   GG bb 28983   HH aa 31854   HH aa 31854   HH aa 31854   HH bb 34103   HH bb 34103   HH bb 34103   HH bb 34103   HH bb 34103   HH bb 34103   II aa 37297   II aa 37297   II bb 38347   II bb 38347   II bb 38347   II bb 38347   II bb 38347   JJ aa 40937   JJ aa 40937   JJ aa 40937   JJ aa 40937   JJ bb 42951   JJ bb 42951   JJ bb 42951   JJ bb 42951}

do_execsql_test 1.2.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685   AA bb 4685   AA bb 4685   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 15147   CC aa 15147   CC aa 15147   CC aa 15147   CC bb 15147   CC bb 15147   DD aa 19179   DD aa 19179   DD aa 19179   DD bb 19179   DD bb 19179   DD bb 19179   DD bb 19179   EE aa 21718   EE aa 21718   EE bb 21718   EE bb 21718   EE bb 21718   FF aa 27386   FF aa 27386   FF aa 27386   FF aa 27386   FF bb 27386   FF bb 27386   FF bb 27386   FF bb 27386   FF bb 27386   FF bb 27386   GG aa 31854   GG aa 31854   GG aa 31854   GG aa 31854   GG bb 31854   GG bb 31854   GG bb 31854   GG bb 31854   HH aa 37297   HH aa 37297   HH aa 37297   HH bb 37297   HH bb 37297   HH bb 37297   HH bb 37297   HH bb 37297   HH bb 37297   II aa 40937   II aa 40937   II bb 40937   II bb 40937   II bb 40937   II bb 40937   II bb 40937   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.2.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 4685   AA bb 4685   AA bb 4685   AA bb 4685   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 13979   CC aa 13979   CC aa 13979   CC aa 13979   CC bb 15147   CC bb 15147   DD aa 16472   DD aa 16472   DD aa 16472   DD bb 19179   DD bb 19179   DD bb 19179   DD bb 19179   EE aa 20069   EE aa 20069   EE bb 21718   EE bb 21718   EE bb 21718   FF aa 23881   FF aa 23881   FF aa 23881   FF aa 23881   FF bb 27386   FF bb 27386   FF bb 27386   FF bb 27386   FF bb 27386   FF bb 27386   GG aa 28983   GG aa 28983   GG aa 28983   GG aa 28983   GG bb 31854   GG bb 31854   GG bb 31854   GG bb 31854   HH aa 34103   HH aa 34103   HH aa 34103   HH bb 37297   HH bb 37297   HH bb 37297   HH bb 37297   HH bb 37297   HH bb 37297   II aa 38347   II aa 38347   II bb 40937   II bb 40937   II bb 40937   II bb 40937   II bb 40937   JJ aa 42951   JJ aa 42951   JJ aa 42951   JJ aa 42951   JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.2.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.2.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 934   AA bb 934   AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   CC aa 934   CC aa 934   CC aa 934   CC aa 934   CC bb 934   CC bb 934   DD aa 934   DD aa 934   DD aa 934   DD bb 959   DD bb 959   DD bb 959   DD bb 959   EE aa 959   EE aa 959   EE bb 959   EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   GG aa 959   GG aa 959   GG aa 959   GG aa 959   GG bb 959   GG bb 959   GG bb 959   GG bb 959   HH aa 979   HH aa 979   HH aa 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979   II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ bb 979   JJ bb 979   JJ bb 979   JJ bb 979}

do_execsql_test 1.2.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 223   AA bb 223   AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   CC aa 158   CC aa 158   CC aa 158   CC aa 158   CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 158   DD bb 158   DD bb 158   DD bb 158   EE aa 113   EE aa 113   EE bb 113   EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102   GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   II aa 102   II aa 102   II bb 102   II bb 102   II bb 102   II bb 102   II bb 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ bb 102   JJ bb 102   JJ bb 102   JJ bb 102}

do_execsql_test 1.2.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058   AA bb 4113   AA bb 4376   BB aa 11263   BB aa 11365   BB aa 11613   BB aa 11626   BB aa 11632   BB aa 11778   BB bb 11185   BB bb 11233   BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 14388   CC aa 14540   CC aa 14717   CC aa 14989   CC bb 14325   CC bb 14801   DD aa 18334   DD aa 18923   DD aa 18955   DD bb 18220   DD bb 18385   DD bb 18463   DD bb 18941   EE aa 20941   EE aa 21605   EE bb 20950   EE bb 21089   EE bb 21466   FF aa 26716   FF aa 26719   FF aa 26768   FF aa 27178   FF bb 26448   FF bb 26516   FF bb 26660   FF bb 26812   FF bb 27091   FF bb 27284   GG aa 31220   GG aa 31374   GG aa 31519   GG aa 31706   GG bb 30916   GG bb 30925   GG bb 31010   GG bb 31694   HH aa 36318   HH aa 36507   HH aa 36817   HH bb 36334   HH bb 36567   HH bb 36614   HH bb 36942   HH bb 36967   HH bb 37164   II aa 40285   II aa 40539   II bb 40132   II bb 40266   II bb 40494   II bb 40516   II bb 40687   JJ aa 43838   JJ aa 43969   JJ aa 44503   JJ aa 44624   JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.2.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 3815   AA bb 4058   AA bb 4113   AA bb 4376   BB aa 6796   BB aa 6898   BB aa 7146   BB aa 7159   BB aa 7165   BB aa 7311   BB bb 11185   BB bb 11233   BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 13220   CC aa 13372   CC aa 13549   CC aa 13821   CC bb 14325   CC bb 14801   DD aa 15627   DD aa 16216   DD aa 16248   DD bb 18220   DD bb 18385   DD bb 18463   DD bb 18941   EE aa 19292   EE aa 19956   EE bb 20950   EE bb 21089   EE bb 21466   FF aa 23211   FF aa 23214   FF aa 23263   FF aa 23673   FF bb 26448   FF bb 26516   FF bb 26660   FF bb 26812   FF bb 27091   FF bb 27284   GG aa 28349   GG aa 28503   GG aa 28648   GG aa 28835   GG bb 30916   GG bb 30925   GG bb 31010   GG bb 31694   HH aa 33124   HH aa 33313   HH aa 33623   HH bb 36334   HH bb 36567   HH bb 36614   HH bb 36942   HH bb 36967   HH bb 37164   II aa 37695   II aa 37949   II bb 40132   II bb 40266   II bb 40494   II bb 40516   II bb 40687   JJ aa 42052   JJ aa 42183   JJ aa 42717   JJ aa 42838   JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.3.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 12025   AA aa 12025   AA aa 12025   AA aa 12025   AA bb 12025   AA bb 12025   AA bb 12025   AA bb 12025   BB aa 15147   BB aa 15147   BB aa 15147   BB aa 15147   BB aa 15147   BB aa 15147   BB bb 15147   BB bb 15147   BB bb 15147   BB bb 15147   BB bb 15147   BB bb 15147   CC aa 19179   CC aa 19179   CC aa 19179   CC aa 19179   CC bb 19179   CC bb 19179   DD aa 21718   DD aa 21718   DD aa 21718   DD bb 21718   DD bb 21718   DD bb 21718   DD bb 21718   EE aa 27386   EE aa 27386   EE bb 27386   EE bb 27386   EE bb 27386   FF aa 31854   FF aa 31854   FF aa 31854   FF aa 31854   FF bb 31854   FF bb 31854   FF bb 31854   FF bb 31854   FF bb 31854   FF bb 31854   GG aa 37297   GG aa 37297   GG aa 37297   GG aa 37297   GG bb 37297   GG bb 37297   GG bb 37297   GG bb 37297   HH aa 40937   HH aa 40937   HH aa 40937   HH bb 40937   HH bb 40937   HH bb 40937   HH bb 40937   HH bb 40937   HH bb 40937   II aa 44737   II aa 44737   II bb 44737   II bb 44737   II bb 44737   II bb 44737   II bb 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.3.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 7558   AA bb 7558   AA bb 7558   AA bb 7558   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB bb 13979   BB bb 13979   BB bb 13979   BB bb 13979   BB bb 13979   BB bb 13979   CC aa 15147   CC aa 15147   CC aa 15147   CC aa 15147   CC bb 16472   CC bb 16472   DD aa 19179   DD aa 19179   DD aa 19179   DD bb 20069   DD bb 20069   DD bb 20069   DD bb 20069   EE aa 21718   EE aa 21718   EE bb 23881   EE bb 23881   EE bb 23881   FF aa 27386   FF aa 27386   FF aa 27386   FF aa 27386   FF bb 28983   FF bb 28983   FF bb 28983   FF bb 28983   FF bb 28983   FF bb 28983   GG aa 31854   GG aa 31854   GG aa 31854   GG aa 31854   GG bb 34103   GG bb 34103   GG bb 34103   GG bb 34103   HH aa 37297   HH aa 37297   HH aa 37297   HH bb 38347   HH bb 38347   HH bb 38347   HH bb 38347   HH bb 38347   HH bb 38347   II aa 40937   II aa 40937   II bb 42951   II bb 42951   II bb 42951   II bb 42951   II bb 42951   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.3.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.3.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 934   AA bb 934   AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   CC aa 934   CC aa 934   CC aa 934   CC aa 934   CC bb 934   CC bb 934   DD aa 959   DD aa 959   DD aa 959   DD bb 959   DD bb 959   DD bb 959   DD bb 959   EE aa 959   EE aa 959   EE bb 959   EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   GG aa 959   GG aa 959   GG aa 959   GG aa 959   GG bb 979   GG bb 979   GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979   II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ bb 979   JJ bb 979   JJ bb 979   JJ bb 979}

do_execsql_test 1.3.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 223   AA bb 223   AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB bb 158   BB bb 158   BB bb 158   BB bb 158   BB bb 158   BB bb 158   CC aa 158   CC aa 158   CC aa 158   CC aa 158   CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 113   DD bb 113   DD bb 113   DD bb 113   EE aa 113   EE aa 113   EE bb 113   EE bb 113   EE bb 113   FF aa 102   FF aa 102   FF aa 102   FF aa 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102   GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   II aa 102   II aa 102   II bb 102   II bb 102   II bb 102   II bb 102   II bb 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ bb 102   JJ bb 102   JJ bb 102   JJ bb 102}

do_execsql_test 1.3.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 11091   AA aa 11114   AA aa 11786   AA aa 11802   AA bb 11155   AA bb 11398   AA bb 11453   AA bb 11716   BB aa 14385   BB aa 14487   BB aa 14735   BB aa 14748   BB aa 14754   BB aa 14900   BB bb 14307   BB bb 14355   BB bb 14361   BB bb 14436   BB bb 14442   BB bb 14514   CC aa 18420   CC aa 18572   CC aa 18749   CC aa 19021   CC bb 18357   CC bb 18833   DD aa 20873   DD aa 21462   DD aa 21494   DD bb 20759   DD bb 20924   DD bb 21002   DD bb 21480   EE aa 26609   EE aa 27273   EE bb 26618   EE bb 26757   EE bb 27134   FF aa 31184   FF aa 31187   FF aa 31236   FF aa 31646   FF bb 30916   FF bb 30984   FF bb 31128   FF bb 31280   FF bb 31559   FF bb 31752   GG aa 36663   GG aa 36817   GG aa 36962   GG aa 37149   GG bb 36359   GG bb 36368   GG bb 36453   GG bb 37137   HH aa 39958   HH aa 40147   HH aa 40457   HH bb 39974   HH bb 40207   HH bb 40254   HH bb 40582   HH bb 40607   HH bb 40804   II aa 44085   II aa 44339   II bb 43932   II bb 44066   II bb 44294   II bb 44316   II bb 44487   JJ aa 43838   JJ aa 43969   JJ aa 44503   JJ aa 44624   JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.3.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 6688   AA bb 6931   AA bb 6986   AA bb 7249   BB aa 11263   BB aa 11365   BB aa 11613   BB aa 11626   BB aa 11632   BB aa 11778   BB bb 13139   BB bb 13187   BB bb 13193   BB bb 13268   BB bb 13274   BB bb 13346   CC aa 14388   CC aa 14540   CC aa 14717   CC aa 14989   CC bb 15650   CC bb 16126   DD aa 18334   DD aa 18923   DD aa 18955   DD bb 19110   DD bb 19275   DD bb 19353   DD bb 19831   EE aa 20941   EE aa 21605   EE bb 23113   EE bb 23252   EE bb 23629   FF aa 26716   FF aa 26719   FF aa 26768   FF aa 27178   FF bb 28045   FF bb 28113   FF bb 28257   FF bb 28409   FF bb 28688   FF bb 28881   GG aa 31220   GG aa 31374   GG aa 31519   GG aa 31706   GG bb 33165   GG bb 33174   GG bb 33259   GG bb 33943   HH aa 36318   HH aa 36507   HH aa 36817   HH bb 37384   HH bb 37617   HH bb 37664   HH bb 37992   HH bb 38017   HH bb 38214   II aa 40285   II aa 40539   II bb 42146   II bb 42280   II bb 42508   II bb 42530   II bb 42701   JJ aa 43838   JJ aa 43969   JJ aa 44503   JJ aa 44624   JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.4.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737   AA bb 44737   AA bb 44737   AA bb 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   CC aa 44737   CC aa 44737   CC aa 44737   CC aa 44737   CC bb 44737   CC bb 44737   DD aa 44737   DD aa 44737   DD aa 44737   DD bb 44737   DD bb 44737   DD bb 44737   DD bb 44737   EE aa 44737   EE aa 44737   EE bb 44737   EE bb 44737   EE bb 44737   FF aa 44737   FF aa 44737   FF aa 44737   FF aa 44737   FF bb 44737   FF bb 44737   FF bb 44737   FF bb 44737   FF bb 44737   FF bb 44737   GG aa 44737   GG aa 44737   GG aa 44737   GG aa 44737   GG bb 44737   GG bb 44737   GG bb 44737   GG bb 44737   HH aa 44737   HH aa 44737   HH aa 44737   HH bb 44737   HH bb 44737   HH bb 44737   HH bb 44737   HH bb 44737   HH bb 44737   II aa 44737   II aa 44737   II bb 44737   II bb 44737   II bb 44737   II bb 44737   II bb 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.4.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737   AA bb 44737   AA bb 44737   AA bb 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   CC aa 44737   CC aa 44737   CC aa 44737   CC aa 44737   CC bb 44737   CC bb 44737   DD aa 44737   DD aa 44737   DD aa 44737   DD bb 44737   DD bb 44737   DD bb 44737   DD bb 44737   EE aa 44737   EE aa 44737   EE bb 44737   EE bb 44737   EE bb 44737   FF aa 44737   FF aa 44737   FF aa 44737   FF aa 44737   FF bb 44737   FF bb 44737   FF bb 44737   FF bb 44737   FF bb 44737   FF bb 44737   GG aa 44737   GG aa 44737   GG aa 44737   GG aa 44737   GG bb 44737   GG bb 44737   GG bb 44737   GG bb 44737   HH aa 44737   HH aa 44737   HH aa 44737   HH bb 44737   HH bb 44737   HH bb 44737   HH bb 44737   HH bb 44737   HH bb 44737   II aa 44737   II aa 44737   II bb 44737   II bb 44737   II bb 44737   II bb 44737   II bb 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.4.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.4.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 979   AA aa 979   AA aa 979   AA aa 979   AA bb 979   AA bb 979   AA bb 979   AA bb 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   CC aa 979   CC aa 979   CC aa 979   CC aa 979   CC bb 979   CC bb 979   DD aa 979   DD aa 979   DD aa 979   DD bb 979   DD bb 979   DD bb 979   DD bb 979   EE aa 979   EE aa 979   EE bb 979   EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979   GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979   II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ bb 979   JJ bb 979   JJ bb 979   JJ bb 979}

do_execsql_test 1.4.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 102   AA aa 102   AA aa 102   AA aa 102   AA bb 102   AA bb 102   AA bb 102   AA bb 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   CC aa 102   CC aa 102   CC aa 102   CC aa 102   CC bb 102   CC bb 102   DD aa 102   DD aa 102   DD aa 102   DD bb 102   DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102   EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102   GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   II aa 102   II aa 102   II bb 102   II bb 102   II bb 102   II bb 102   II bb 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ bb 102   JJ bb 102   JJ bb 102   JJ bb 102}

do_execsql_test 1.4.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867   AA bb 44110   AA bb 44165   AA bb 44428   BB aa 43975   BB aa 44077   BB aa 44325   BB aa 44338   BB aa 44344   BB aa 44490   BB bb 43897   BB bb 43945   BB bb 43951   BB bb 44026   BB bb 44032   BB bb 44104   CC aa 43978   CC aa 44130   CC aa 44307   CC aa 44579   CC bb 43915   CC bb 44391   DD aa 43892   DD aa 44481   DD aa 44513   DD bb 43778   DD bb 43943   DD bb 44021   DD bb 44499   EE aa 43960   EE aa 44624   EE bb 43969   EE bb 44108   EE bb 44485   FF aa 44067   FF aa 44070   FF aa 44119   FF aa 44529   FF bb 43799   FF bb 43867   FF bb 44011   FF bb 44163   FF bb 44442   FF bb 44635   GG aa 44103   GG aa 44257   GG aa 44402   GG aa 44589   GG bb 43799   GG bb 43808   GG bb 43893   GG bb 44577   HH aa 43758   HH aa 43947   HH aa 44257   HH bb 43774   HH bb 44007   HH bb 44054   HH bb 44382   HH bb 44407   HH bb 44604   II aa 44085   II aa 44339   II bb 43932   II bb 44066   II bb 44294   II bb 44316   II bb 44487   JJ aa 43838   JJ aa 43969   JJ aa 44503   JJ aa 44624   JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.4.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867   AA bb 44110   AA bb 44165   AA bb 44428   BB aa 43975   BB aa 44077   BB aa 44325   BB aa 44338   BB aa 44344   BB aa 44490   BB bb 43897   BB bb 43945   BB bb 43951   BB bb 44026   BB bb 44032   BB bb 44104   CC aa 43978   CC aa 44130   CC aa 44307   CC aa 44579   CC bb 43915   CC bb 44391   DD aa 43892   DD aa 44481   DD aa 44513   DD bb 43778   DD bb 43943   DD bb 44021   DD bb 44499   EE aa 43960   EE aa 44624   EE bb 43969   EE bb 44108   EE bb 44485   FF aa 44067   FF aa 44070   FF aa 44119   FF aa 44529   FF bb 43799   FF bb 43867   FF bb 44011   FF bb 44163   FF bb 44442   FF bb 44635   GG aa 44103   GG aa 44257   GG aa 44402   GG aa 44589   GG bb 43799   GG bb 43808   GG bb 43893   GG bb 44577   HH aa 43758   HH aa 43947   HH aa 44257   HH bb 43774   HH bb 44007   HH bb 44054   HH bb 44382   HH bb 44407   HH bb 44604   II aa 44085   II aa 44339   II bb 43932   II bb 44066   II bb 44294   II bb 44316   II bb 44487   JJ aa 43838   JJ aa 43969   JJ aa 44503   JJ aa 44624   JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.5.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.5.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.5.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.5.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.5.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.5.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.5.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.6.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025   CC bb 12025   CC bb 12025   DD aa 10462   DD aa 10462   DD aa 10462   DD bb 10462   DD bb 10462   DD bb 10462   DD bb 10462   EE aa 7154   EE aa 7154   EE bb 7154   EE bb 7154   EE bb 7154   FF aa 6571   FF aa 6571   FF aa 6571   FF aa 6571   FF bb 6571   FF bb 6571   FF bb 6571   FF bb 6571   FF bb 6571   FF bb 6571   GG aa 8207   GG aa 8207   GG aa 8207   GG aa 8207   GG bb 8207   GG bb 8207   GG bb 8207   GG bb 8207   HH aa 10136   HH aa 10136   HH aa 10136   HH bb 10136   HH bb 10136   HH bb 10136   HH bb 10136   HH bb 10136   HH bb 10136   II aa 9911   II aa 9911   II bb 9911   II bb 9911   II bb 9911   II bb 9911   II bb 9911   JJ aa 9083   JJ aa 9083   JJ aa 9083   JJ aa 9083   JJ bb 9083   JJ bb 9083   JJ bb 9083   JJ bb 9083}

do_execsql_test 1.6.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307   AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 5251   BB bb 5251   BB bb 5251   BB bb 5251   BB bb 5251   BB bb 5251   CC aa 7340   CC aa 7340   CC aa 7340   CC aa 7340   CC bb 6421   CC bb 6421   DD aa 3122   DD aa 3122   DD aa 3122   DD bb 2493   DD bb 2493   DD bb 2493   DD bb 2493   EE aa 4032   EE aa 4032   EE bb 3597   EE bb 3597   EE bb 3597   FF aa 2539   FF aa 2539   FF aa 2539   FF aa 2539   FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812   GG aa 5668   GG aa 5668   GG aa 5668   GG aa 5668   GG bb 5102   GG bb 5102   GG bb 5102   GG bb 5102   HH aa 4468   HH aa 4468   HH aa 4468   HH bb 5120   HH bb 5120   HH bb 5120   HH bb 5120   HH bb 5120   HH bb 5120   II aa 5443   II aa 5443   II bb 4244   II bb 4244   II bb 4244   II bb 4244   II bb 4244   JJ aa 3640   JJ aa 3640   JJ aa 3640   JJ aa 3640   JJ bb 4604   JJ bb 4604   JJ bb 4604   JJ bb 4604}

do_execsql_test 1.6.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.6.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 934   AA bb 934   AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB bb 870   BB bb 870   BB bb 870   BB bb 870   BB bb 870   BB bb 870   CC aa 840   CC aa 840   CC aa 840   CC aa 840   CC bb 840   CC bb 840   DD aa 822   DD aa 822   DD aa 822   DD bb 845   DD bb 845   DD bb 845   DD bb 845   EE aa 959   EE aa 959   EE bb 959   EE bb 959   EE bb 959   FF aa 777   FF aa 777   FF aa 777   FF aa 777   FF bb 768   FF bb 768   FF bb 768   FF bb 768   FF bb 768   FF bb 768   GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 938   GG bb 938   GG bb 938   GG bb 938   HH aa 938   HH aa 938   HH aa 938   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979   II aa 979   II bb 963   II bb 963   II bb 963   II bb 963   II bb 963   JJ aa 805   JJ aa 805   JJ aa 805   JJ aa 805   JJ bb 899   JJ bb 899   JJ bb 899   JJ bb 899}

do_execsql_test 1.6.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 223   AA bb 223   AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB bb 247   BB bb 247   BB bb 247   BB bb 247   BB bb 247   BB bb 247   CC aa 247   CC aa 247   CC aa 247   CC aa 247   CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 224   DD bb 224   DD bb 224   DD bb 224   EE aa 224   EE aa 224   EE bb 113   EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113   FF bb 208   FF bb 208   FF bb 208   FF bb 208   FF bb 208   FF bb 208   GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102   GG bb 102   GG bb 102   HH aa 148   HH aa 148   HH aa 148   HH bb 160   HH bb 160   HH bb 160   HH bb 160   HH bb 160   HH bb 160   II aa 133   II aa 133   II bb 133   II bb 133   II bb 133   II bb 133   II bb 133   JJ aa 250   JJ aa 250   JJ aa 250   JJ aa 250   JJ bb 113   JJ bb 113   JJ bb 113   JJ bb 113}

do_execsql_test 1.6.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025   CC bb 12025   CC bb 12025   DD aa 10462   DD aa 10462   DD aa 10462   DD bb 10462   DD bb 10462   DD bb 10462   DD bb 10462   EE aa 7154   EE aa 7154   EE bb 7154   EE bb 7154   EE bb 7154   FF aa 6571   FF aa 6571   FF aa 6571   FF aa 6571   FF bb 6571   FF bb 6571   FF bb 6571   FF bb 6571   FF bb 6571   FF bb 6571   GG aa 8207   GG aa 8207   GG aa 8207   GG aa 8207   GG bb 8207   GG bb 8207   GG bb 8207   GG bb 8207   HH aa 10136   HH aa 10136   HH aa 10136   HH bb 10136   HH bb 10136   HH bb 10136   HH bb 10136   HH bb 10136   HH bb 10136   II aa 9911   II aa 9911   II bb 9911   II bb 9911   II bb 9911   II bb 9911   II bb 9911   JJ aa 9083   JJ aa 9083   JJ aa 9083   JJ aa 9083   JJ bb 9083   JJ bb 9083   JJ bb 9083   JJ bb 9083}

do_execsql_test 1.6.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307   AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 5251   BB bb 5251   BB bb 5251   BB bb 5251   BB bb 5251   BB bb 5251   CC aa 7340   CC aa 7340   CC aa 7340   CC aa 7340   CC bb 6421   CC bb 6421   DD aa 3122   DD aa 3122   DD aa 3122   DD bb 2493   DD bb 2493   DD bb 2493   DD bb 2493   EE aa 4032   EE aa 4032   EE bb 3597   EE bb 3597   EE bb 3597   FF aa 2539   FF aa 2539   FF aa 2539   FF aa 2539   FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812   GG aa 5668   GG aa 5668   GG aa 5668   GG aa 5668   GG bb 5102   GG bb 5102   GG bb 5102   GG bb 5102   HH aa 4468   HH aa 4468   HH aa 4468   HH bb 5120   HH bb 5120   HH bb 5120   HH bb 5120   HH bb 5120   HH bb 5120   II aa 5443   II aa 5443   II bb 4244   II bb 4244   II bb 4244   II bb 4244   II bb 4244   JJ aa 3640   JJ aa 3640   JJ aa 3640   JJ aa 3640   JJ bb 4604   JJ bb 4604   JJ bb 4604   JJ bb 4604}

do_execsql_test 1.7.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025   CC bb 12025   CC bb 12025   DD aa 15147   DD aa 15147   DD aa 15147   DD bb 15147   DD bb 15147   DD bb 15147   DD bb 15147   EE aa 14494   EE aa 14494   EE bb 14494   EE bb 14494   EE bb 14494   FF aa 9693   FF aa 9693   FF aa 9693   FF aa 9693   FF bb 9693   FF bb 9693   FF bb 9693   FF bb 9693   FF bb 9693   FF bb 9693   GG aa 12239   GG aa 12239   GG aa 12239   GG aa 12239   GG bb 12239   GG bb 12239   GG bb 12239   GG bb 12239   HH aa 12675   HH aa 12675   HH aa 12675   HH bb 12675   HH bb 12675   HH bb 12675   HH bb 12675   HH bb 12675   HH bb 12675   II aa 15579   II aa 15579   II bb 15579   II bb 15579   II bb 15579   II bb 15579   II bb 15579   JJ aa 13551   JJ aa 13551   JJ aa 13551   JJ aa 13551   JJ bb 13551   JJ bb 13551   JJ bb 13551   JJ bb 13551}

do_execsql_test 1.7.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307   AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   CC aa 9718   CC aa 9718   CC aa 9718   CC aa 9718   CC bb 9294   CC bb 9294   DD aa 7589   DD aa 7589   DD aa 7589   DD bb 4447   DD bb 4447   DD bb 4447   DD bb 4447   EE aa 5200   EE aa 5200   EE bb 4922   EE bb 4922   EE bb 4922   FF aa 5246   FF aa 5246   FF aa 5246   FF aa 5246   FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702   GG aa 7317   GG aa 7317   GG aa 7317   GG aa 7317   GG bb 7265   GG bb 7265   GG bb 7265   GG bb 7265   HH aa 7973   HH aa 7973   HH aa 7973   HH bb 6717   HH bb 6717   HH bb 6717   HH bb 6717   HH bb 6717   HH bb 6717   II aa 8314   II aa 8314   II bb 6493   II bb 6493   II bb 6493   II bb 6493   II bb 6493   JJ aa 6834   JJ aa 6834   JJ aa 6834   JJ aa 6834   JJ bb 5654   JJ bb 5654   JJ bb 5654   JJ bb 5654}

do_execsql_test 1.7.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.7.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 934   AA bb 934   AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   CC aa 870   CC aa 870   CC aa 870   CC aa 870   CC bb 840   CC bb 840   DD aa 840   DD aa 840   DD aa 840   DD bb 845   DD bb 845   DD bb 845   DD bb 845   EE aa 959   EE aa 959   EE bb 959   EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959   FF bb 777   FF bb 777   FF bb 777   FF bb 777   FF bb 777   FF bb 777   GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 938   GG bb 938   GG bb 938   GG bb 938   HH aa 938   HH aa 938   HH aa 938   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979   II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979   JJ aa 963   JJ aa 963   JJ aa 963   JJ aa 963   JJ bb 899   JJ bb 899   JJ bb 899   JJ bb 899}

do_execsql_test 1.7.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 223   AA bb 223   AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   CC aa 247   CC aa 247   CC aa 247   CC aa 247   CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 158   DD bb 158   DD bb 158   DD bb 158   EE aa 224   EE aa 224   EE bb 113   EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102   GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 148   HH bb 148   HH bb 148   HH bb 148   HH bb 148   HH bb 148   II aa 133   II aa 133   II bb 133   II bb 133   II bb 133   II bb 133   II bb 133   JJ aa 133   JJ aa 133   JJ aa 133   JJ aa 133   JJ bb 113   JJ bb 113   JJ bb 113   JJ bb 113}

do_execsql_test 1.7.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025   CC bb 12025   CC bb 12025   DD aa 15147   DD aa 15147   DD aa 15147   DD bb 15147   DD bb 15147   DD bb 15147   DD bb 15147   EE aa 14494   EE aa 14494   EE bb 14494   EE bb 14494   EE bb 14494   FF aa 9693   FF aa 9693   FF aa 9693   FF aa 9693   FF bb 9693   FF bb 9693   FF bb 9693   FF bb 9693   FF bb 9693   FF bb 9693   GG aa 12239   GG aa 12239   GG aa 12239   GG aa 12239   GG bb 12239   GG bb 12239   GG bb 12239   GG bb 12239   HH aa 12675   HH aa 12675   HH aa 12675   HH bb 12675   HH bb 12675   HH bb 12675   HH bb 12675   HH bb 12675   HH bb 12675   II aa 15579   II aa 15579   II bb 15579   II bb 15579   II bb 15579   II bb 15579   II bb 15579   JJ aa 13551   JJ aa 13551   JJ aa 13551   JJ aa 13551   JJ bb 13551   JJ bb 13551   JJ bb 13551   JJ bb 13551}

do_execsql_test 1.7.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307   AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558   CC aa 9718   CC aa 9718   CC aa 9718   CC aa 9718   CC bb 9294   CC bb 9294   DD aa 7589   DD aa 7589   DD aa 7589   DD bb 4447   DD bb 4447   DD bb 4447   DD bb 4447   EE aa 5200   EE aa 5200   EE bb 4922   EE bb 4922   EE bb 4922   FF aa 5246   FF aa 5246   FF aa 5246   FF aa 5246   FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702   GG aa 7317   GG aa 7317   GG aa 7317   GG aa 7317   GG bb 7265   GG bb 7265   GG bb 7265   GG bb 7265   HH aa 7973   HH aa 7973   HH aa 7973   HH bb 6717   HH bb 6717   HH bb 6717   HH bb 6717   HH bb 6717   HH bb 6717   II aa 8314   II aa 8314   II bb 6493   II bb 6493   II bb 6493   II bb 6493   II bb 6493   JJ aa 6834   JJ aa 6834   JJ aa 6834   JJ aa 6834   JJ bb 5654   JJ bb 5654   JJ bb 5654   JJ bb 5654}

do_execsql_test 1.8.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685   AA bb 4685   AA bb 4685   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 15147   CC aa 15147   CC aa 15147   CC aa 15147   CC bb 15147   CC bb 15147   DD aa 19179   DD aa 19179   DD aa 19179   DD bb 19179   DD bb 19179   DD bb 19179   DD bb 19179   EE aa 17033   EE aa 17033   EE bb 17033   EE bb 17033   EE bb 17033   FF aa 15361   FF aa 15361   FF aa 15361   FF aa 15361   FF bb 15361   FF bb 15361   FF bb 15361   FF bb 15361   FF bb 15361   FF bb 15361   GG aa 16707   GG aa 16707   GG aa 16707   GG aa 16707   GG bb 16707   GG bb 16707   GG bb 16707   GG bb 16707   HH aa 18118   HH aa 18118   HH aa 18118   HH bb 18118   HH bb 18118   HH bb 18118   HH bb 18118   HH bb 18118   HH bb 18118   II aa 19219   II aa 19219   II bb 19219   II bb 19219   II bb 19219   II bb 19219   II bb 19219   JJ aa 17351   JJ aa 17351   JJ aa 17351   JJ aa 17351   JJ bb 17351   JJ bb 17351   JJ bb 17351   JJ bb 17351}

do_execsql_test 1.8.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 4685   AA bb 4685   AA bb 4685   AA bb 4685   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 11672   CC aa 11672   CC aa 11672   CC aa 11672   CC bb 10462   CC bb 10462   DD aa 8914   DD aa 8914   DD aa 8914   DD bb 7154   DD bb 7154   DD bb 7154   DD bb 7154   EE aa 6090   EE aa 6090   EE bb 6571   EE bb 6571   EE bb 6571   FF aa 7409   FF aa 7409   FF aa 7409   FF aa 7409   FF bb 8207   FF bb 8207   FF bb 8207   FF bb 8207   FF bb 8207   FF bb 8207   GG aa 8914   GG aa 8914   GG aa 8914   GG aa 8914   GG bb 10136   GG bb 10136   GG bb 10136   GG bb 10136   HH aa 10222   HH aa 10222   HH aa 10222   HH bb 9911   HH bb 9911   HH bb 9911   HH bb 9911   HH bb 9911   HH bb 9911   II aa 9364   II aa 9364   II bb 9083   II bb 9083   II bb 9083   II bb 9083   II bb 9083   JJ aa 8848   JJ aa 8848   JJ aa 8848   JJ aa 8848   JJ bb 7440   JJ bb 7440   JJ bb 7440   JJ bb 7440}

do_execsql_test 1.8.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.8.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 934   AA bb 934   AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   CC aa 870   CC aa 870   CC aa 870   CC aa 870   CC bb 840   CC bb 840   DD aa 845   DD aa 845   DD aa 845   DD bb 959   DD bb 959   DD bb 959   DD bb 959   EE aa 959   EE aa 959   EE bb 959   EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 938   GG bb 938   GG bb 938   GG bb 938   HH aa 979   HH aa 979   HH aa 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979   II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979   JJ aa 963   JJ aa 963   JJ aa 963   JJ aa 963   JJ bb 899   JJ bb 899   JJ bb 899   JJ bb 899}

do_execsql_test 1.8.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 223   AA bb 223   AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   CC aa 158   CC aa 158   CC aa 158   CC aa 158   CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 158   DD bb 158   DD bb 158   DD bb 158   EE aa 113   EE aa 113   EE bb 113   EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102   GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 133   II aa 133   II bb 133   II bb 133   II bb 133   II bb 133   II bb 133   JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 113   JJ bb 113   JJ bb 113   JJ bb 113}

do_execsql_test 1.8.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058   AA bb 4113   AA bb 4376   BB aa 11263   BB aa 11365   BB aa 11613   BB aa 11626   BB aa 11632   BB aa 11778   BB bb 11185   BB bb 11233   BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 14388   CC aa 14540   CC aa 14717   CC aa 14989   CC bb 14325   CC bb 14801   DD aa 18334   DD aa 18923   DD aa 18955   DD bb 18220   DD bb 18385   DD bb 18463   DD bb 18941   EE aa 16256   EE aa 16920   EE bb 16265   EE bb 16404   EE bb 16781   FF aa 14691   FF aa 14694   FF aa 14743   FF aa 15153   FF bb 14423   FF bb 14491   FF bb 14635   FF bb 14787   FF bb 15066   FF bb 15259   GG aa 16073   GG aa 16227   GG aa 16372   GG aa 16559   GG bb 15769   GG bb 15778   GG bb 15863   GG bb 16547   HH aa 17139   HH aa 17328   HH aa 17638   HH bb 17155   HH bb 17388   HH bb 17435   HH bb 17763   HH bb 17788   HH bb 17985   II aa 18567   II aa 18821   II bb 18414   II bb 18548   II bb 18776   II bb 18798   II bb 18969   JJ aa 16452   JJ aa 16583   JJ aa 17117   JJ aa 17238   JJ bb 16512   JJ bb 16997   JJ bb 17015   JJ bb 17094}

do_execsql_test 1.8.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 3815   AA bb 4058   AA bb 4113   AA bb 4376   BB aa 6796   BB aa 6898   BB aa 7146   BB aa 7159   BB aa 7165   BB aa 7311   BB bb 11185   BB bb 11233   BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 10913   CC aa 11065   CC aa 11242   CC aa 11514   CC bb 9640   CC bb 10116   DD aa 8069   DD aa 8658   DD aa 8690   DD bb 6195   DD bb 6360   DD bb 6438   DD bb 6916   EE aa 5313   EE aa 5977   EE bb 5803   EE bb 5942   EE bb 6319   FF aa 6739   FF aa 6742   FF aa 6791   FF aa 7201   FF bb 7269   FF bb 7337   FF bb 7481   FF bb 7633   FF bb 7912   FF bb 8105   GG aa 8280   GG aa 8434   GG aa 8579   GG aa 8766   GG bb 9198   GG bb 9207   GG bb 9292   GG bb 9976   HH aa 9243   HH aa 9432   HH aa 9742   HH bb 8948   HH bb 9181   HH bb 9228   HH bb 9556   HH bb 9581   HH bb 9778   II aa 8712   II aa 8966   II bb 8278   II bb 8412   II bb 8640   II bb 8662   II bb 8833   JJ aa 7949   JJ aa 8080   JJ aa 8614   JJ aa 8735   JJ bb 6601   JJ bb 7086   JJ bb 7104   JJ bb 7183}

do_execsql_test 1.9.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685   AA bb 4685   AA bb 4685   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 15147   CC aa 15147   CC aa 15147   CC aa 15147   CC bb 15147   CC bb 15147   DD aa 14494   DD aa 14494   DD aa 14494   DD bb 14494   DD bb 14494   DD bb 14494   DD bb 14494   EE aa 9693   EE aa 9693   EE bb 9693   EE bb 9693   EE bb 9693   FF aa 12239   FF aa 12239   FF aa 12239   FF aa 12239   FF bb 12239   FF bb 12239   FF bb 12239   FF bb 12239   FF bb 12239   FF bb 12239   GG aa 12675   GG aa 12675   GG aa 12675   GG aa 12675   GG bb 12675   GG bb 12675   GG bb 12675   GG bb 12675   HH aa 15579   HH aa 15579   HH aa 15579   HH bb 15579   HH bb 15579   HH bb 15579   HH bb 15579   HH bb 15579   HH bb 15579   II aa 13551   II aa 13551   II bb 13551   II bb 13551   II bb 13551   II bb 13551   II bb 13551   JJ aa 12883   JJ aa 12883   JJ aa 12883   JJ aa 12883   JJ bb 12883   JJ bb 12883   JJ bb 12883   JJ bb 12883}

do_execsql_test 1.9.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 4685   AA bb 4685   AA bb 4685   AA bb 4685   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB bb 9718   BB bb 9718   BB bb 9718   BB bb 9718   BB bb 9718   BB bb 9718   CC aa 9294   CC aa 9294   CC aa 9294   CC aa 9294   CC bb 7589   CC bb 7589   DD aa 4447   DD aa 4447   DD aa 4447   DD bb 5200   DD bb 5200   DD bb 5200   DD bb 5200   EE aa 4922   EE aa 4922   EE bb 5246   EE bb 5246   EE bb 5246   FF aa 4702   FF aa 4702   FF aa 4702   FF aa 4702   FF bb 7317   FF bb 7317   FF bb 7317   FF bb 7317   FF bb 7317   FF bb 7317   GG aa 7265   GG aa 7265   GG aa 7265   GG aa 7265   GG bb 7973   GG bb 7973   GG bb 7973   GG bb 7973   HH aa 6717   HH aa 6717   HH aa 6717   HH bb 8314   HH bb 8314   HH bb 8314   HH bb 8314   HH bb 8314   HH bb 8314   II aa 6493   II aa 6493   II bb 6834   II bb 6834   II bb 6834   II bb 6834   II bb 6834   JJ aa 5654   JJ aa 5654   JJ aa 5654   JJ aa 5654   JJ bb 6390   JJ bb 6390   JJ bb 6390   JJ bb 6390}

do_execsql_test 1.9.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.9.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 934   AA bb 934   AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB bb 870   BB bb 870   BB bb 870   BB bb 870   BB bb 870   BB bb 870   CC aa 840   CC aa 840   CC aa 840   CC aa 840   CC bb 840   CC bb 840   DD aa 845   DD aa 845   DD aa 845   DD bb 959   DD bb 959   DD bb 959   DD bb 959   EE aa 959   EE aa 959   EE bb 959   EE bb 959   EE bb 959   FF aa 777   FF aa 777   FF aa 777   FF aa 777   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 938   GG bb 938   GG bb 938   GG bb 938   HH aa 979   HH aa 979   HH aa 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979   II aa 979   II bb 963   II bb 963   II bb 963   II bb 963   II bb 963   JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 899   JJ bb 899   JJ bb 899   JJ bb 899}

do_execsql_test 1.9.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 223   AA bb 223   AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB bb 247   BB bb 247   BB bb 247   BB bb 247   BB bb 247   BB bb 247   CC aa 158   CC aa 158   CC aa 158   CC aa 158   CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 224   DD bb 224   DD bb 224   DD bb 224   EE aa 113   EE aa 113   EE bb 113   EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102   GG bb 102   GG bb 102   HH aa 148   HH aa 148   HH aa 148   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 133   II aa 133   II bb 133   II bb 133   II bb 133   II bb 133   II bb 133   JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 113   JJ bb 113   JJ bb 113   JJ bb 113}

do_execsql_test 1.9.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058   AA bb 4113   AA bb 4376   BB aa 11263   BB aa 11365   BB aa 11613   BB aa 11626   BB aa 11632   BB aa 11778   BB bb 11185   BB bb 11233   BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 14388   CC aa 14540   CC aa 14717   CC aa 14989   CC bb 14325   CC bb 14801   DD aa 13649   DD aa 14238   DD aa 14270   DD bb 13535   DD bb 13700   DD bb 13778   DD bb 14256   EE aa 8916   EE aa 9580   EE bb 8925   EE bb 9064   EE bb 9441   FF aa 11569   FF aa 11572   FF aa 11621   FF aa 12031   FF bb 11301   FF bb 11369   FF bb 11513   FF bb 11665   FF bb 11944   FF bb 12137   GG aa 12041   GG aa 12195   GG aa 12340   GG aa 12527   GG bb 11737   GG bb 11746   GG bb 11831   GG bb 12515   HH aa 14600   HH aa 14789   HH aa 15099   HH bb 14616   HH bb 14849   HH bb 14896   HH bb 15224   HH bb 15249   HH bb 15446   II aa 12899   II aa 13153   II bb 12746   II bb 12880   II bb 13108   II bb 13130   II bb 13301   JJ aa 11984   JJ aa 12115   JJ aa 12649   JJ aa 12770   JJ bb 12044   JJ bb 12529   JJ bb 12547   JJ bb 12626}

do_execsql_test 1.9.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 3815   AA bb 4058   AA bb 4113   AA bb 4376   BB aa 6796   BB aa 6898   BB aa 7146   BB aa 7159   BB aa 7165   BB aa 7311   BB bb 8878   BB bb 8926   BB bb 8932   BB bb 9007   BB bb 9013   BB bb 9085   CC aa 8535   CC aa 8687   CC aa 8864   CC aa 9136   CC bb 6767   CC bb 7243   DD aa 3602   DD aa 4191   DD aa 4223   DD bb 4241   DD bb 4406   DD bb 4484   DD bb 4962   EE aa 4145   EE aa 4809   EE bb 4478   EE bb 4617   EE bb 4994   FF aa 4032   FF aa 4035   FF aa 4084   FF aa 4494   FF bb 6379   FF bb 6447   FF bb 6591   FF bb 6743   FF bb 7022   FF bb 7215   GG aa 6631   GG aa 6785   GG aa 6930   GG aa 7117   GG bb 7035   GG bb 7044   GG bb 7129   GG bb 7813   HH aa 5738   HH aa 5927   HH aa 6237   HH bb 7351   HH bb 7584   HH bb 7631   HH bb 7959   HH bb 7984   HH bb 8181   II aa 5841   II aa 6095   II bb 6029   II bb 6163   II bb 6391   II bb 6413   II bb 6584   JJ aa 4755   JJ aa 4886   JJ aa 5420   JJ aa 5541   JJ bb 5551   JJ bb 6036   JJ bb 6054   JJ bb 6133}

do_execsql_test 1.10.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685   AA bb 4685   AA bb 4685   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB aa 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 15147   CC aa 15147   CC aa 15147   CC aa 15147   CC bb 15147   CC bb 15147   DD aa 19179   DD aa 19179   DD aa 19179   DD bb 19179   DD bb 19179   DD bb 19179   DD bb 19179   EE aa 17033   EE aa 17033   EE bb 17033   EE bb 17033   EE bb 17033   FF aa 15361   FF aa 15361   FF aa 15361   FF aa 15361   FF bb 15361   FF bb 15361   FF bb 15361   FF bb 15361   FF bb 15361   FF bb 15361   GG aa 16707   GG aa 16707   GG aa 16707   GG aa 16707   GG bb 16707   GG bb 16707   GG bb 16707   GG bb 16707   HH aa 18118   HH aa 18118   HH aa 18118   HH bb 18118   HH bb 18118   HH bb 18118   HH bb 18118   HH bb 18118   HH bb 18118   II aa 19219   II aa 19219   II bb 19219   II bb 19219   II bb 19219   II bb 19219   II bb 19219   JJ aa 17351   JJ aa 17351   JJ aa 17351   JJ aa 17351   JJ bb 17351   JJ bb 17351   JJ bb 17351   JJ bb 17351}

do_execsql_test 1.10.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 4685   AA bb 4685   AA bb 4685   AA bb 4685   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 11672   CC aa 11672   CC aa 11672   CC aa 11672   CC bb 10462   CC bb 10462   DD aa 8914   DD aa 8914   DD aa 8914   DD bb 7154   DD bb 7154   DD bb 7154   DD bb 7154   EE aa 6090   EE aa 6090   EE bb 6571   EE bb 6571   EE bb 6571   FF aa 7409   FF aa 7409   FF aa 7409   FF aa 7409   FF bb 8207   FF bb 8207   FF bb 8207   FF bb 8207   FF bb 8207   FF bb 8207   GG aa 8914   GG aa 8914   GG aa 8914   GG aa 8914   GG bb 10136   GG bb 10136   GG bb 10136   GG bb 10136   HH aa 10222   HH aa 10222   HH aa 10222   HH bb 9911   HH bb 9911   HH bb 9911   HH bb 9911   HH bb 9911   HH bb 9911   II aa 9364   II aa 9364   II bb 9083   II bb 9083   II bb 9083   II bb 9083   II bb 9083   JJ aa 8848   JJ aa 8848   JJ aa 8848   JJ aa 8848   JJ bb 7440   JJ bb 7440   JJ bb 7440   JJ bb 7440}

do_execsql_test 1.10.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.10.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 934   AA bb 934   AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934   CC aa 870   CC aa 870   CC aa 870   CC aa 870   CC bb 840   CC bb 840   DD aa 845   DD aa 845   DD aa 845   DD bb 959   DD bb 959   DD bb 959   DD bb 959   EE aa 959   EE aa 959   EE bb 959   EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 938   GG bb 938   GG bb 938   GG bb 938   HH aa 979   HH aa 979   HH aa 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979   II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979   JJ aa 963   JJ aa 963   JJ aa 963   JJ aa 963   JJ bb 899   JJ bb 899   JJ bb 899   JJ bb 899}

do_execsql_test 1.10.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 223   AA bb 223   AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223   CC aa 158   CC aa 158   CC aa 158   CC aa 158   CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 158   DD bb 158   DD bb 158   DD bb 158   EE aa 113   EE aa 113   EE bb 113   EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102   GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 133   II aa 133   II bb 133   II bb 133   II bb 133   II bb 133   II bb 133   JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 113   JJ bb 113   JJ bb 113   JJ bb 113}

do_execsql_test 1.10.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058   AA bb 4113   AA bb 4376   BB aa 11263   BB aa 11365   BB aa 11613   BB aa 11626   BB aa 11632   BB aa 11778   BB bb 11185   BB bb 11233   BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 14388   CC aa 14540   CC aa 14717   CC aa 14989   CC bb 14325   CC bb 14801   DD aa 18334   DD aa 18923   DD aa 18955   DD bb 18220   DD bb 18385   DD bb 18463   DD bb 18941   EE aa 16256   EE aa 16920   EE bb 16265   EE bb 16404   EE bb 16781   FF aa 14691   FF aa 14694   FF aa 14743   FF aa 15153   FF bb 14423   FF bb 14491   FF bb 14635   FF bb 14787   FF bb 15066   FF bb 15259   GG aa 16073   GG aa 16227   GG aa 16372   GG aa 16559   GG bb 15769   GG bb 15778   GG bb 15863   GG bb 16547   HH aa 17139   HH aa 17328   HH aa 17638   HH bb 17155   HH bb 17388   HH bb 17435   HH bb 17763   HH bb 17788   HH bb 17985   II aa 18567   II aa 18821   II bb 18414   II bb 18548   II bb 18776   II bb 18798   II bb 18969   JJ aa 16452   JJ aa 16583   JJ aa 17117   JJ aa 17238   JJ bb 16512   JJ bb 16997   JJ bb 17015   JJ bb 17094}

do_execsql_test 1.10.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 3815   AA bb 4058   AA bb 4113   AA bb 4376   BB aa 6796   BB aa 6898   BB aa 7146   BB aa 7159   BB aa 7165   BB aa 7311   BB bb 11185   BB bb 11233   BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 10913   CC aa 11065   CC aa 11242   CC aa 11514   CC bb 9640   CC bb 10116   DD aa 8069   DD aa 8658   DD aa 8690   DD bb 6195   DD bb 6360   DD bb 6438   DD bb 6916   EE aa 5313   EE aa 5977   EE bb 5803   EE bb 5942   EE bb 6319   FF aa 6739   FF aa 6742   FF aa 6791   FF aa 7201   FF bb 7269   FF bb 7337   FF bb 7481   FF bb 7633   FF bb 7912   FF bb 8105   GG aa 8280   GG aa 8434   GG aa 8579   GG aa 8766   GG bb 9198   GG bb 9207   GG bb 9292   GG bb 9976   HH aa 9243   HH aa 9432   HH aa 9742   HH bb 8948   HH bb 9181   HH bb 9228   HH bb 9556   HH bb 9581   HH bb 9778   II aa 8712   II aa 8966   II bb 8278   II bb 8412   II bb 8640   II bb 8662   II bb 8833   JJ aa 7949   JJ aa 8080   JJ aa 8614   JJ aa 8735   JJ bb 6601   JJ bb 7086   JJ bb 7104   JJ bb 7183}

do_execsql_test 1.11.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737   AA bb 44737   AA bb 44737   AA bb 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   CC aa 44737   CC aa 44737   CC aa 44737   CC aa 44737   CC bb 44737   CC bb 44737   DD aa 40052   DD aa 40052   DD aa 40052   DD bb 40052   DD bb 40052   DD bb 40052   DD bb 40052   EE aa 32712   EE aa 32712   EE bb 32712   EE bb 32712   EE bb 32712   FF aa 29590   FF aa 29590   FF aa 29590   FF aa 29590   FF bb 29590   FF bb 29590   FF bb 29590   FF bb 29590   FF bb 29590   FF bb 29590   GG aa 25558   GG aa 25558   GG aa 25558   GG aa 25558   GG bb 25558   GG bb 25558   GG bb 25558   GG bb 25558   HH aa 23019   HH aa 23019   HH aa 23019   HH bb 23019   HH bb 23019   HH bb 23019   HH bb 23019   HH bb 23019   HH bb 23019   II aa 17351   II aa 17351   II bb 17351   II bb 17351   II bb 17351   II bb 17351   II bb 17351   JJ aa 12883   JJ aa 12883   JJ aa 12883   JJ aa 12883   JJ bb 12883   JJ bb 12883   JJ bb 12883   JJ bb 12883}

do_execsql_test 1.11.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737   AA bb 44737   AA bb 44737   AA bb 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB bb 42430   BB bb 42430   BB bb 42430   BB bb 42430   BB bb 42430   BB bb 42430   CC aa 40052   CC aa 40052   CC aa 40052   CC aa 40052   CC bb 37179   CC bb 37179   DD aa 32712   DD aa 32712   DD aa 32712   DD bb 30758   DD bb 30758   DD bb 30758   DD bb 30758   EE aa 29590   EE aa 29590   EE bb 28265   EE bb 28265   EE bb 28265   FF aa 25558   FF aa 25558   FF aa 25558   FF aa 25558   FF bb 24668   FF bb 24668   FF bb 24668   FF bb 24668   FF bb 24668   FF bb 24668   GG aa 23019   GG aa 23019   GG aa 23019   GG aa 23019   GG bb 20856   GG bb 20856   GG bb 20856   GG bb 20856   HH aa 17351   HH aa 17351   HH aa 17351   HH bb 15754   HH bb 15754   HH bb 15754   HH bb 15754   HH bb 15754   HH bb 15754   II aa 12883   II aa 12883   II bb 10634   II bb 10634   II bb 10634   II bb 10634   II bb 10634   JJ aa 7440   JJ aa 7440   JJ aa 7440   JJ aa 7440   JJ bb 6390   JJ bb 6390   JJ bb 6390   JJ bb 6390}

do_execsql_test 1.11.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.11.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 979   AA aa 979   AA aa 979   AA aa 979   AA bb 979   AA bb 979   AA bb 979   AA bb 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   CC aa 979   CC aa 979   CC aa 979   CC aa 979   CC bb 979   CC bb 979   DD aa 979   DD aa 979   DD aa 979   DD bb 979   DD bb 979   DD bb 979   DD bb 979   EE aa 979   EE aa 979   EE bb 979   EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979   GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979   II aa 979   II bb 963   II bb 963   II bb 963   II bb 963   II bb 963   JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 899   JJ bb 899   JJ bb 899   JJ bb 899}

do_execsql_test 1.11.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 102   AA aa 102   AA aa 102   AA aa 102   AA bb 102   AA bb 102   AA bb 102   AA bb 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   CC aa 102   CC aa 102   CC aa 102   CC aa 102   CC bb 102   CC bb 102   DD aa 102   DD aa 102   DD aa 102   DD bb 102   DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102   EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102   GG bb 102   GG bb 102   HH aa 113   HH aa 113   HH aa 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   II aa 113   II aa 113   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 113   JJ bb 113   JJ bb 113   JJ bb 113}

do_execsql_test 1.11.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867   AA bb 44110   AA bb 44165   AA bb 44428   BB aa 43975   BB aa 44077   BB aa 44325   BB aa 44338   BB aa 44344   BB aa 44490   BB bb 43897   BB bb 43945   BB bb 43951   BB bb 44026   BB bb 44032   BB bb 44104   CC aa 43978   CC aa 44130   CC aa 44307   CC aa 44579   CC bb 43915   CC bb 44391   DD aa 39207   DD aa 39796   DD aa 39828   DD bb 39093   DD bb 39258   DD bb 39336   DD bb 39814   EE aa 31935   EE aa 32599   EE bb 31944   EE bb 32083   EE bb 32460   FF aa 28920   FF aa 28923   FF aa 28972   FF aa 29382   FF bb 28652   FF bb 28720   FF bb 28864   FF bb 29016   FF bb 29295   FF bb 29488   GG aa 24924   GG aa 25078   GG aa 25223   GG aa 25410   GG bb 24620   GG bb 24629   GG bb 24714   GG bb 25398   HH aa 22040   HH aa 22229   HH aa 22539   HH bb 22056   HH bb 22289   HH bb 22336   HH bb 22664   HH bb 22689   HH bb 22886   II aa 16699   II aa 16953   II bb 16546   II bb 16680   II bb 16908   II bb 16930   II bb 17101   JJ aa 11984   JJ aa 12115   JJ aa 12649   JJ aa 12770   JJ bb 12044   JJ bb 12529   JJ bb 12547   JJ bb 12626}

do_execsql_test 1.11.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867   AA bb 44110   AA bb 44165   AA bb 44428   BB aa 43975   BB aa 44077   BB aa 44325   BB aa 44338   BB aa 44344   BB aa 44490   BB bb 41590   BB bb 41638   BB bb 41644   BB bb 41719   BB bb 41725   BB bb 41797   CC aa 39293   CC aa 39445   CC aa 39622   CC aa 39894   CC bb 36357   CC bb 36833   DD aa 31867   DD aa 32456   DD aa 32488   DD bb 29799   DD bb 29964   DD bb 30042   DD bb 30520   EE aa 28813   EE aa 29477   EE bb 27497   EE bb 27636   EE bb 28013   FF aa 24888   FF aa 24891   FF aa 24940   FF aa 25350   FF bb 23730   FF bb 23798   FF bb 23942   FF bb 24094   FF bb 24373   FF bb 24566   GG aa 22385   GG aa 22539   GG aa 22684   GG aa 22871   GG bb 19918   GG bb 19927   GG bb 20012   GG bb 20696   HH aa 16372   HH aa 16561   HH aa 16871   HH bb 14791   HH bb 15024   HH bb 15071   HH bb 15399   HH bb 15424   HH bb 15621   II aa 12231   II aa 12485   II bb 9829   II bb 9963   II bb 10191   II bb 10213   II bb 10384   JJ aa 6541   JJ aa 6672   JJ aa 7206   JJ aa 7327   JJ bb 5551   JJ bb 6036   JJ bb 6054   JJ bb 6133}

do_execsql_test 1.12.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685   AA bb 4685   AA bb 4685   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340   BB bb 7340   BB bb 7340   BB bb 7340   BB bb 7340   BB bb 7340   BB bb 7340   CC aa 3122   CC aa 3122   CC aa 3122   CC aa 3122   CC bb 3122   CC bb 3122   DD aa 4032   DD aa 4032   DD aa 4032   DD bb 4032   DD bb 4032   DD bb 4032   DD bb 4032   EE aa 2539   EE aa 2539   EE bb 2539   EE bb 2539   EE bb 2539   FF aa 5668   FF aa 5668   FF aa 5668   FF aa 5668   FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668   GG aa 4468   GG aa 4468   GG aa 4468   GG aa 4468   GG bb 4468   GG bb 4468   GG bb 4468   GG bb 4468   HH aa 5443   HH aa 5443   HH aa 5443   HH bb 5443   HH bb 5443   HH bb 5443   HH bb 5443   HH bb 5443   HH bb 5443   II aa 3640   II aa 3640   II bb 3640   II bb 3640   II bb 3640   II bb 3640   II bb 3640   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 3800   JJ bb 3800   JJ bb 3800   JJ bb 3800}

do_execsql_test 1.12.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 2378   AA bb 2378   AA bb 2378   AA bb 2378   BB aa 2873   BB aa 2873   BB aa 2873   BB aa 2873   BB aa 2873   BB aa 2873   BB bb 4467   BB bb 4467   BB bb 4467   BB bb 4467   BB bb 4467   BB bb 4467   CC aa 1954   CC aa 1954   CC aa 1954   CC aa 1954   CC bb 1168   CC bb 1168   DD aa 1325   DD aa 1325   DD aa 1325   DD bb 2707   DD bb 2707   DD bb 2707   DD bb 2707   EE aa 890   EE aa 890   EE bb 1649   EE bb 1649   EE bb 1649   FF aa 2163   FF aa 2163   FF aa 2163   FF aa 2163   FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505   GG aa 1597   GG aa 1597   GG aa 1597   GG aa 1597   GG bb 2871   GG bb 2871   GG bb 2871   GG bb 2871   HH aa 2249   HH aa 2249   HH aa 2249   HH bb 3194   HH bb 3194   HH bb 3194   HH bb 3194   HH bb 3194   HH bb 3194   II aa 1050   II aa 1050   II bb 2590   II bb 2590   II bb 2590   II bb 2590   II bb 2590   JJ aa 2014   JJ aa 2014   JJ aa 2014   JJ aa 2014   JJ bb 1786   JJ bb 1786   JJ bb 1786   JJ bb 1786}

do_execsql_test 1.12.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.12.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 870   AA bb 870   AA bb 870   AA bb 870   BB aa 762   BB aa 762   BB aa 762   BB aa 762   BB aa 762   BB aa 762   BB bb 840   BB bb 840   BB bb 840   BB bb 840   BB bb 840   BB bb 840   CC aa 759   CC aa 759   CC aa 759   CC aa 759   CC bb 822   CC bb 822   DD aa 845   DD aa 845   DD aa 845   DD bb 959   DD bb 959   DD bb 959   DD bb 959   EE aa 777   EE aa 777   EE bb 768   EE bb 768   EE bb 768   FF aa 670   FF aa 670   FF aa 670   FF aa 670   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   GG aa 634   GG aa 634   GG aa 634   GG aa 634   GG bb 938   GG bb 938   GG bb 938   GG bb 938   HH aa 979   HH aa 979   HH aa 979   HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   II aa 652   II aa 652   II bb 805   II bb 805   II bb 805   II bb 805   II bb 805   JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 839   JJ bb 839   JJ bb 839   JJ bb 839}

do_execsql_test 1.12.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 309   AA bb 309   AA bb 309   AA bb 309   BB aa 247   BB aa 247   BB aa 247   BB aa 247   BB aa 247   BB aa 247   BB bb 633   BB bb 633   BB bb 633   BB bb 633   BB bb 633   BB bb 633   CC aa 158   CC aa 158   CC aa 158   CC aa 158   CC bb 346   CC bb 346   DD aa 224   DD aa 224   DD aa 224   DD bb 238   DD bb 238   DD bb 238   DD bb 238   EE aa 113   EE aa 113   EE bb 252   EE bb 252   EE bb 252   FF aa 208   FF aa 208   FF aa 208   FF aa 208   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 148   GG aa 148   GG aa 148   GG aa 148   GG bb 160   GG bb 160   GG bb 160   GG bb 160   HH aa 480   HH aa 480   HH aa 480   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 398   II aa 398   II bb 250   II bb 250   II bb 250   II bb 250   II bb 250   JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 257   JJ bb 257   JJ bb 257   JJ bb 257}

do_execsql_test 1.12.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058   AA bb 4113   AA bb 4376   BB aa 6578   BB aa 6680   BB aa 6928   BB aa 6941   BB aa 6947   BB aa 7093   BB bb 6500   BB bb 6548   BB bb 6554   BB bb 6629   BB bb 6635   BB bb 6707   CC aa 2363   CC aa 2515   CC aa 2692   CC aa 2964   CC bb 2300   CC bb 2776   DD aa 3187   DD aa 3776   DD aa 3808   DD bb 3073   DD bb 3238   DD bb 3316   DD bb 3794   EE aa 1762   EE aa 2426   EE bb 1771   EE bb 1910   EE bb 2287   FF aa 4998   FF aa 5001   FF aa 5050   FF aa 5460   FF bb 4730   FF bb 4798   FF bb 4942   FF bb 5094   FF bb 5373   FF bb 5566   GG aa 3834   GG aa 3988   GG aa 4133   GG aa 4320   GG bb 3530   GG bb 3539   GG bb 3624   GG bb 4308   HH aa 4464   HH aa 4653   HH aa 4963   HH bb 4480   HH bb 4713   HH bb 4760   HH bb 5088   HH bb 5113   HH bb 5310   II aa 2988   II aa 3242   II bb 2835   II bb 2969   II bb 3197   II bb 3219   II bb 3390   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 2961   JJ bb 3446   JJ bb 3464   JJ bb 3543}

do_execsql_test 1.12.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 1508   AA bb 1751   AA bb 1806   AA bb 2069   BB aa 2111   BB aa 2213   BB aa 2461   BB aa 2474   BB aa 2480   BB aa 2626   BB bb 3627   BB bb 3675   BB bb 3681   BB bb 3756   BB bb 3762   BB bb 3834   CC aa 1195   CC aa 1347   CC aa 1524   CC aa 1796   CC bb 346   CC bb 822   DD aa 480   DD aa 1069   DD aa 1101   DD bb 1748   DD bb 1913   DD bb 1991   DD bb 2469   EE aa 113   EE aa 777   EE bb 881   EE bb 1020   EE bb 1397   FF aa 1493   FF aa 1496   FF aa 1545   FF aa 1955   FF bb 2567   FF bb 2635   FF bb 2779   FF bb 2931   FF bb 3210   FF bb 3403   GG aa 963   GG aa 1117   GG aa 1262   GG aa 1449   GG bb 1933   GG bb 1942   GG bb 2027   GG bb 2711   HH aa 1270   HH aa 1459   HH aa 1769   HH bb 2231   HH bb 2464   HH bb 2511   HH bb 2839   HH bb 2864   HH bb 3061   II aa 398   II aa 652   II bb 1785   II bb 1919   II bb 2147   II bb 2169   II bb 2340   JJ aa 1115   JJ aa 1246   JJ aa 1780   JJ aa 1901   JJ bb 947   JJ bb 1432   JJ bb 1450   JJ bb 1529}

do_execsql_test 1.13.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 12025   AA aa 12025   AA aa 12025   AA aa 12025   AA bb 12025   AA bb 12025   AA bb 12025   AA bb 12025   BB aa 10462   BB aa 10462   BB aa 10462   BB aa 10462   BB aa 10462   BB aa 10462   BB bb 10462   BB bb 10462   BB bb 10462   BB bb 10462   BB bb 10462   BB bb 10462   CC aa 7154   CC aa 7154   CC aa 7154   CC aa 7154   CC bb 7154   CC bb 7154   DD aa 6571   DD aa 6571   DD aa 6571   DD bb 6571   DD bb 6571   DD bb 6571   DD bb 6571   EE aa 8207   EE aa 8207   EE bb 8207   EE bb 8207   EE bb 8207   FF aa 10136   FF aa 10136   FF aa 10136   FF aa 10136   FF bb 10136   FF bb 10136   FF bb 10136   FF bb 10136   FF bb 10136   FF bb 10136   GG aa 9911   GG aa 9911   GG aa 9911   GG aa 9911   GG bb 9911   GG bb 9911   GG bb 9911   GG bb 9911   HH aa 9083   HH aa 9083   HH aa 9083   HH bb 9083   HH bb 9083   HH bb 9083   HH bb 9083   HH bb 9083   HH bb 9083   II aa 7440   II aa 7440   II bb 7440   II bb 7440   II bb 7440   II bb 7440   II bb 7440   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 3800   JJ bb 3800   JJ bb 3800   JJ bb 3800}

do_execsql_test 1.13.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 5251   AA bb 5251   AA bb 5251   AA bb 5251   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340   BB bb 6421   BB bb 6421   BB bb 6421   BB bb 6421   BB bb 6421   BB bb 6421   CC aa 3122   CC aa 3122   CC aa 3122   CC aa 3122   CC bb 2493   CC bb 2493   DD aa 4032   DD aa 4032   DD aa 4032   DD bb 3597   DD bb 3597   DD bb 3597   DD bb 3597   EE aa 2539   EE aa 2539   EE bb 3812   EE bb 3812   EE bb 3812   FF aa 5668   FF aa 5668   FF aa 5668   FF aa 5668   FF bb 5102   FF bb 5102   FF bb 5102   FF bb 5102   FF bb 5102   FF bb 5102   GG aa 4468   GG aa 4468   GG aa 4468   GG aa 4468   GG bb 5120   GG bb 5120   GG bb 5120   GG bb 5120   HH aa 5443   HH aa 5443   HH aa 5443   HH bb 4244   HH bb 4244   HH bb 4244   HH bb 4244   HH bb 4244   HH bb 4244   II aa 3640   II aa 3640   II bb 4604   II bb 4604   II bb 4604   II bb 4604   II bb 4604   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 1786   JJ bb 1786   JJ bb 1786   JJ bb 1786}

do_execsql_test 1.13.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.13.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 870   AA bb 870   AA bb 870   AA bb 870   BB aa 840   BB aa 840   BB aa 840   BB aa 840   BB aa 840   BB aa 840   BB bb 840   BB bb 840   BB bb 840   BB bb 840   BB bb 840   BB bb 840   CC aa 822   CC aa 822   CC aa 822   CC aa 822   CC bb 845   CC bb 845   DD aa 959   DD aa 959   DD aa 959   DD bb 959   DD bb 959   DD bb 959   DD bb 959   EE aa 777   EE aa 777   EE bb 768   EE bb 768   EE bb 768   FF aa 938   FF aa 938   FF aa 938   FF aa 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 979   GG bb 979   GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   II aa 805   II aa 805   II bb 899   II bb 899   II bb 899   II bb 899   II bb 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 839   JJ bb 839   JJ bb 839   JJ bb 839}

do_execsql_test 1.13.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 247   AA bb 247   AA bb 247   AA bb 247   BB aa 247   BB aa 247   BB aa 247   BB aa 247   BB aa 247   BB aa 247   BB bb 158   BB bb 158   BB bb 158   BB bb 158   BB bb 158   BB bb 158   CC aa 158   CC aa 158   CC aa 158   CC aa 158   CC bb 224   CC bb 224   DD aa 224   DD aa 224   DD aa 224   DD bb 113   DD bb 113   DD bb 113   DD bb 113   EE aa 113   EE aa 113   EE bb 208   EE bb 208   EE bb 208   FF aa 102   FF aa 102   FF aa 102   FF aa 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 148   GG aa 148   GG aa 148   GG aa 148   GG bb 160   GG bb 160   GG bb 160   GG bb 160   HH aa 133   HH aa 133   HH aa 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 250   II aa 250   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 257   JJ bb 257   JJ bb 257   JJ bb 257}

do_execsql_test 1.13.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 11091   AA aa 11114   AA aa 11786   AA aa 11802   AA bb 11155   AA bb 11398   AA bb 11453   AA bb 11716   BB aa 9700   BB aa 9802   BB aa 10050   BB aa 10063   BB aa 10069   BB aa 10215   BB bb 9622   BB bb 9670   BB bb 9676   BB bb 9751   BB bb 9757   BB bb 9829   CC aa 6395   CC aa 6547   CC aa 6724   CC aa 6996   CC bb 6332   CC bb 6808   DD aa 5726   DD aa 6315   DD aa 6347   DD bb 5612   DD bb 5777   DD bb 5855   DD bb 6333   EE aa 7430   EE aa 8094   EE bb 7439   EE bb 7578   EE bb 7955   FF aa 9466   FF aa 9469   FF aa 9518   FF aa 9928   FF bb 9198   FF bb 9266   FF bb 9410   FF bb 9562   FF bb 9841   FF bb 10034   GG aa 9277   GG aa 9431   GG aa 9576   GG aa 9763   GG bb 8973   GG bb 8982   GG bb 9067   GG bb 9751   HH aa 8104   HH aa 8293   HH aa 8603   HH bb 8120   HH bb 8353   HH bb 8400   HH bb 8728   HH bb 8753   HH bb 8950   II aa 6788   II aa 7042   II bb 6635   II bb 6769   II bb 6997   II bb 7019   II bb 7190   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 2961   JJ bb 3446   JJ bb 3464   JJ bb 3543}

do_execsql_test 1.13.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 4381   AA bb 4624   AA bb 4679   AA bb 4942   BB aa 6578   BB aa 6680   BB aa 6928   BB aa 6941   BB aa 6947   BB aa 7093   BB bb 5581   BB bb 5629   BB bb 5635   BB bb 5710   BB bb 5716   BB bb 5788   CC aa 2363   CC aa 2515   CC aa 2692   CC aa 2964   CC bb 1671   CC bb 2147   DD aa 3187   DD aa 3776   DD aa 3808   DD bb 2638   DD bb 2803   DD bb 2881   DD bb 3359   EE aa 1762   EE aa 2426   EE bb 3044   EE bb 3183   EE bb 3560   FF aa 4998   FF aa 5001   FF aa 5050   FF aa 5460   FF bb 4164   FF bb 4232   FF bb 4376   FF bb 4528   FF bb 4807   FF bb 5000   GG aa 3834   GG aa 3988   GG aa 4133   GG aa 4320   GG bb 4182   GG bb 4191   GG bb 4276   GG bb 4960   HH aa 4464   HH aa 4653   HH aa 4963   HH bb 3281   HH bb 3514   HH bb 3561   HH bb 3889   HH bb 3914   HH bb 4111   II aa 2988   II aa 3242   II bb 3799   II bb 3933   II bb 4161   II bb 4183   II bb 4354   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 947   JJ bb 1432   JJ bb 1450   JJ bb 1529}

do_execsql_test 1.14.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737   AA bb 44737   AA bb 44737   AA bb 44737   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB bb 40052   BB bb 40052   BB bb 40052   BB bb 40052   BB bb 40052   BB bb 40052   CC aa 32712   CC aa 32712   CC aa 32712   CC aa 32712   CC bb 32712   CC bb 32712   DD aa 29590   DD aa 29590   DD aa 29590   DD bb 29590   DD bb 29590   DD bb 29590   DD bb 29590   EE aa 25558   EE aa 25558   EE bb 25558   EE bb 25558   EE bb 25558   FF aa 23019   FF aa 23019   FF aa 23019   FF aa 23019   FF bb 23019   FF bb 23019   FF bb 23019   FF bb 23019   FF bb 23019   FF bb 23019   GG aa 17351   GG aa 17351   GG aa 17351   GG aa 17351   GG bb 17351   GG bb 17351   GG bb 17351   GG bb 17351   HH aa 12883   HH aa 12883   HH aa 12883   HH bb 12883   HH bb 12883   HH bb 12883   HH bb 12883   HH bb 12883   HH bb 12883   II aa 7440   II aa 7440   II bb 7440   II bb 7440   II bb 7440   II bb 7440   II bb 7440   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 3800   JJ bb 3800   JJ bb 3800   JJ bb 3800}

do_execsql_test 1.14.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 42430   AA bb 42430   AA bb 42430   AA bb 42430   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB bb 37179   BB bb 37179   BB bb 37179   BB bb 37179   BB bb 37179   BB bb 37179   CC aa 32712   CC aa 32712   CC aa 32712   CC aa 32712   CC bb 30758   CC bb 30758   DD aa 29590   DD aa 29590   DD aa 29590   DD bb 28265   DD bb 28265   DD bb 28265   DD bb 28265   EE aa 25558   EE aa 25558   EE bb 24668   EE bb 24668   EE bb 24668   FF aa 23019   FF aa 23019   FF aa 23019   FF aa 23019   FF bb 20856   FF bb 20856   FF bb 20856   FF bb 20856   FF bb 20856   FF bb 20856   GG aa 17351   GG aa 17351   GG aa 17351   GG aa 17351   GG bb 15754   GG bb 15754   GG bb 15754   GG bb 15754   HH aa 12883   HH aa 12883   HH aa 12883   HH bb 10634   HH bb 10634   HH bb 10634   HH bb 10634   HH bb 10634   HH bb 10634   II aa 7440   II aa 7440   II bb 6390   II bb 6390   II bb 6390   II bb 6390   II bb 6390   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 1786   JJ bb 1786   JJ bb 1786   JJ bb 1786}

do_execsql_test 1.14.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.14.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 979   AA aa 979   AA aa 979   AA aa 979   AA bb 979   AA bb 979   AA bb 979   AA bb 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   CC aa 979   CC aa 979   CC aa 979   CC aa 979   CC bb 979   CC bb 979   DD aa 979   DD aa 979   DD aa 979   DD bb 979   DD bb 979   DD bb 979   DD bb 979   EE aa 979   EE aa 979   EE bb 979   EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979   GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   II aa 899   II aa 899   II bb 899   II bb 899   II bb 899   II bb 899   II bb 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 839   JJ bb 839   JJ bb 839   JJ bb 839}

do_execsql_test 1.14.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 102   AA aa 102   AA aa 102   AA aa 102   AA bb 102   AA bb 102   AA bb 102   AA bb 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   CC aa 102   CC aa 102   CC aa 102   CC aa 102   CC bb 102   CC bb 102   DD aa 102   DD aa 102   DD aa 102   DD bb 102   DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102   EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 113   GG aa 113   GG aa 113   GG aa 113   GG bb 113   GG bb 113   GG bb 113   GG bb 113   HH aa 113   HH aa 113   HH aa 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   II aa 113   II aa 113   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 257   JJ bb 257   JJ bb 257   JJ bb 257}

do_execsql_test 1.14.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867   AA bb 44110   AA bb 44165   AA bb 44428   BB aa 39290   BB aa 39392   BB aa 39640   BB aa 39653   BB aa 39659   BB aa 39805   BB bb 39212   BB bb 39260   BB bb 39266   BB bb 39341   BB bb 39347   BB bb 39419   CC aa 31953   CC aa 32105   CC aa 32282   CC aa 32554   CC bb 31890   CC bb 32366   DD aa 28745   DD aa 29334   DD aa 29366   DD bb 28631   DD bb 28796   DD bb 28874   DD bb 29352   EE aa 24781   EE aa 25445   EE bb 24790   EE bb 24929   EE bb 25306   FF aa 22349   FF aa 22352   FF aa 22401   FF aa 22811   FF bb 22081   FF bb 22149   FF bb 22293   FF bb 22445   FF bb 22724   FF bb 22917   GG aa 16717   GG aa 16871   GG aa 17016   GG aa 17203   GG bb 16413   GG bb 16422   GG bb 16507   GG bb 17191   HH aa 11904   HH aa 12093   HH aa 12403   HH bb 11920   HH bb 12153   HH bb 12200   HH bb 12528   HH bb 12553   HH bb 12750   II aa 6788   II aa 7042   II bb 6635   II bb 6769   II bb 6997   II bb 7019   II bb 7190   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 2961   JJ bb 3446   JJ bb 3464   JJ bb 3543}

do_execsql_test 1.14.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 41560   AA bb 41803   AA bb 41858   AA bb 42121   BB aa 39290   BB aa 39392   BB aa 39640   BB aa 39653   BB aa 39659   BB aa 39805   BB bb 36339   BB bb 36387   BB bb 36393   BB bb 36468   BB bb 36474   BB bb 36546   CC aa 31953   CC aa 32105   CC aa 32282   CC aa 32554   CC bb 29936   CC bb 30412   DD aa 28745   DD aa 29334   DD aa 29366   DD bb 27306   DD bb 27471   DD bb 27549   DD bb 28027   EE aa 24781   EE aa 25445   EE bb 23900   EE bb 24039   EE bb 24416   FF aa 22349   FF aa 22352   FF aa 22401   FF aa 22811   FF bb 19918   FF bb 19986   FF bb 20130   FF bb 20282   FF bb 20561   FF bb 20754   GG aa 16717   GG aa 16871   GG aa 17016   GG aa 17203   GG bb 14816   GG bb 14825   GG bb 14910   GG bb 15594   HH aa 11904   HH aa 12093   HH aa 12403   HH bb 9671   HH bb 9904   HH bb 9951   HH bb 10279   HH bb 10304   HH bb 10501   II aa 6788   II aa 7042   II bb 5585   II bb 5719   II bb 5947   II bb 5969   II bb 6140   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 947   JJ bb 1432   JJ bb 1450   JJ bb 1529}

do_execsql_test 1.15.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737   AA bb 44737   AA bb 44737   AA bb 44737   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB bb 40052   BB bb 40052   BB bb 40052   BB bb 40052   BB bb 40052   BB bb 40052   CC aa 32712   CC aa 32712   CC aa 32712   CC aa 32712   CC bb 32712   CC bb 32712   DD aa 29590   DD aa 29590   DD aa 29590   DD bb 29590   DD bb 29590   DD bb 29590   DD bb 29590   EE aa 25558   EE aa 25558   EE bb 25558   EE bb 25558   EE bb 25558   FF aa 23019   FF aa 23019   FF aa 23019   FF aa 23019   FF bb 23019   FF bb 23019   FF bb 23019   FF bb 23019   FF bb 23019   FF bb 23019   GG aa 17351   GG aa 17351   GG aa 17351   GG aa 17351   GG bb 17351   GG bb 17351   GG bb 17351   GG bb 17351   HH aa 12883   HH aa 12883   HH aa 12883   HH bb 12883   HH bb 12883   HH bb 12883   HH bb 12883   HH bb 12883   HH bb 12883   II aa 7440   II aa 7440   II bb 7440   II bb 7440   II bb 7440   II bb 7440   II bb 7440   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 3800   JJ bb 3800   JJ bb 3800   JJ bb 3800}

do_execsql_test 1.15.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 42430   AA bb 42430   AA bb 42430   AA bb 42430   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB bb 37179   BB bb 37179   BB bb 37179   BB bb 37179   BB bb 37179   BB bb 37179   CC aa 32712   CC aa 32712   CC aa 32712   CC aa 32712   CC bb 30758   CC bb 30758   DD aa 29590   DD aa 29590   DD aa 29590   DD bb 28265   DD bb 28265   DD bb 28265   DD bb 28265   EE aa 25558   EE aa 25558   EE bb 24668   EE bb 24668   EE bb 24668   FF aa 23019   FF aa 23019   FF aa 23019   FF aa 23019   FF bb 20856   FF bb 20856   FF bb 20856   FF bb 20856   FF bb 20856   FF bb 20856   GG aa 17351   GG aa 17351   GG aa 17351   GG aa 17351   GG bb 15754   GG bb 15754   GG bb 15754   GG bb 15754   HH aa 12883   HH aa 12883   HH aa 12883   HH bb 10634   HH bb 10634   HH bb 10634   HH bb 10634   HH bb 10634   HH bb 10634   II aa 7440   II aa 7440   II bb 6390   II bb 6390   II bb 6390   II bb 6390   II bb 6390   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 1786   JJ bb 1786   JJ bb 1786   JJ bb 1786}

do_execsql_test 1.15.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.15.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 979   AA aa 979   AA aa 979   AA aa 979   AA bb 979   AA bb 979   AA bb 979   AA bb 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   CC aa 979   CC aa 979   CC aa 979   CC aa 979   CC bb 979   CC bb 979   DD aa 979   DD aa 979   DD aa 979   DD bb 979   DD bb 979   DD bb 979   DD bb 979   EE aa 979   EE aa 979   EE bb 979   EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979   GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   II aa 899   II aa 899   II bb 899   II bb 899   II bb 899   II bb 899   II bb 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 839   JJ bb 839   JJ bb 839   JJ bb 839}

do_execsql_test 1.15.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 102   AA aa 102   AA aa 102   AA aa 102   AA bb 102   AA bb 102   AA bb 102   AA bb 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   CC aa 102   CC aa 102   CC aa 102   CC aa 102   CC bb 102   CC bb 102   DD aa 102   DD aa 102   DD aa 102   DD bb 102   DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102   EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 113   GG aa 113   GG aa 113   GG aa 113   GG bb 113   GG bb 113   GG bb 113   GG bb 113   HH aa 113   HH aa 113   HH aa 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   II aa 113   II aa 113   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 257   JJ bb 257   JJ bb 257   JJ bb 257}

do_execsql_test 1.15.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867   AA bb 44110   AA bb 44165   AA bb 44428   BB aa 39290   BB aa 39392   BB aa 39640   BB aa 39653   BB aa 39659   BB aa 39805   BB bb 39212   BB bb 39260   BB bb 39266   BB bb 39341   BB bb 39347   BB bb 39419   CC aa 31953   CC aa 32105   CC aa 32282   CC aa 32554   CC bb 31890   CC bb 32366   DD aa 28745   DD aa 29334   DD aa 29366   DD bb 28631   DD bb 28796   DD bb 28874   DD bb 29352   EE aa 24781   EE aa 25445   EE bb 24790   EE bb 24929   EE bb 25306   FF aa 22349   FF aa 22352   FF aa 22401   FF aa 22811   FF bb 22081   FF bb 22149   FF bb 22293   FF bb 22445   FF bb 22724   FF bb 22917   GG aa 16717   GG aa 16871   GG aa 17016   GG aa 17203   GG bb 16413   GG bb 16422   GG bb 16507   GG bb 17191   HH aa 11904   HH aa 12093   HH aa 12403   HH bb 11920   HH bb 12153   HH bb 12200   HH bb 12528   HH bb 12553   HH bb 12750   II aa 6788   II aa 7042   II bb 6635   II bb 6769   II bb 6997   II bb 7019   II bb 7190   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 2961   JJ bb 3446   JJ bb 3464   JJ bb 3543}

do_execsql_test 1.15.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 41560   AA bb 41803   AA bb 41858   AA bb 42121   BB aa 39290   BB aa 39392   BB aa 39640   BB aa 39653   BB aa 39659   BB aa 39805   BB bb 36339   BB bb 36387   BB bb 36393   BB bb 36468   BB bb 36474   BB bb 36546   CC aa 31953   CC aa 32105   CC aa 32282   CC aa 32554   CC bb 29936   CC bb 30412   DD aa 28745   DD aa 29334   DD aa 29366   DD bb 27306   DD bb 27471   DD bb 27549   DD bb 28027   EE aa 24781   EE aa 25445   EE bb 23900   EE bb 24039   EE bb 24416   FF aa 22349   FF aa 22352   FF aa 22401   FF aa 22811   FF bb 19918   FF bb 19986   FF bb 20130   FF bb 20282   FF bb 20561   FF bb 20754   GG aa 16717   GG aa 16871   GG aa 17016   GG aa 17203   GG bb 14816   GG bb 14825   GG bb 14910   GG bb 15594   HH aa 11904   HH aa 12093   HH aa 12403   HH bb 9671   HH bb 9904   HH bb 9951   HH bb 10279   HH bb 10304   HH bb 10501   II aa 6788   II aa 7042   II bb 5585   II bb 5719   II bb 5947   II bb 5969   II bb 6140   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 947   JJ bb 1432   JJ bb 1450   JJ bb 1529}

do_execsql_test 1.16.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685   AA bb 4685   AA bb 4685   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340   BB bb 7340   BB bb 7340   BB bb 7340   BB bb 7340   BB bb 7340   BB bb 7340   CC aa 3122   CC aa 3122   CC aa 3122   CC aa 3122   CC bb 3122   CC bb 3122   DD aa 4032   DD aa 4032   DD aa 4032   DD bb 4032   DD bb 4032   DD bb 4032   DD bb 4032   EE aa 2539   EE aa 2539   EE bb 2539   EE bb 2539   EE bb 2539   FF aa 5668   FF aa 5668   FF aa 5668   FF aa 5668   FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668   GG aa 4468   GG aa 4468   GG aa 4468   GG aa 4468   GG bb 4468   GG bb 4468   GG bb 4468   GG bb 4468   HH aa 5443   HH aa 5443   HH aa 5443   HH bb 5443   HH bb 5443   HH bb 5443   HH bb 5443   HH bb 5443   HH bb 5443   II aa 3640   II aa 3640   II bb 3640   II bb 3640   II bb 3640   II bb 3640   II bb 3640   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 3800   JJ bb 3800   JJ bb 3800   JJ bb 3800}

do_execsql_test 1.16.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 2378   AA bb 2378   AA bb 2378   AA bb 2378   BB aa 2873   BB aa 2873   BB aa 2873   BB aa 2873   BB aa 2873   BB aa 2873   BB bb 4467   BB bb 4467   BB bb 4467   BB bb 4467   BB bb 4467   BB bb 4467   CC aa 1954   CC aa 1954   CC aa 1954   CC aa 1954   CC bb 1168   CC bb 1168   DD aa 1325   DD aa 1325   DD aa 1325   DD bb 2707   DD bb 2707   DD bb 2707   DD bb 2707   EE aa 890   EE aa 890   EE bb 1649   EE bb 1649   EE bb 1649   FF aa 2163   FF aa 2163   FF aa 2163   FF aa 2163   FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505   GG aa 1597   GG aa 1597   GG aa 1597   GG aa 1597   GG bb 2871   GG bb 2871   GG bb 2871   GG bb 2871   HH aa 2249   HH aa 2249   HH aa 2249   HH bb 3194   HH bb 3194   HH bb 3194   HH bb 3194   HH bb 3194   HH bb 3194   II aa 1050   II aa 1050   II bb 2590   II bb 2590   II bb 2590   II bb 2590   II bb 2590   JJ aa 2014   JJ aa 2014   JJ aa 2014   JJ aa 2014   JJ bb 1786   JJ bb 1786   JJ bb 1786   JJ bb 1786}

do_execsql_test 1.16.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.16.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 870   AA bb 870   AA bb 870   AA bb 870   BB aa 762   BB aa 762   BB aa 762   BB aa 762   BB aa 762   BB aa 762   BB bb 840   BB bb 840   BB bb 840   BB bb 840   BB bb 840   BB bb 840   CC aa 759   CC aa 759   CC aa 759   CC aa 759   CC bb 822   CC bb 822   DD aa 845   DD aa 845   DD aa 845   DD bb 959   DD bb 959   DD bb 959   DD bb 959   EE aa 777   EE aa 777   EE bb 768   EE bb 768   EE bb 768   FF aa 670   FF aa 670   FF aa 670   FF aa 670   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   GG aa 634   GG aa 634   GG aa 634   GG aa 634   GG bb 938   GG bb 938   GG bb 938   GG bb 938   HH aa 979   HH aa 979   HH aa 979   HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   II aa 652   II aa 652   II bb 805   II bb 805   II bb 805   II bb 805   II bb 805   JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 839   JJ bb 839   JJ bb 839   JJ bb 839}

do_execsql_test 1.16.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 309   AA bb 309   AA bb 309   AA bb 309   BB aa 247   BB aa 247   BB aa 247   BB aa 247   BB aa 247   BB aa 247   BB bb 633   BB bb 633   BB bb 633   BB bb 633   BB bb 633   BB bb 633   CC aa 158   CC aa 158   CC aa 158   CC aa 158   CC bb 346   CC bb 346   DD aa 224   DD aa 224   DD aa 224   DD bb 238   DD bb 238   DD bb 238   DD bb 238   EE aa 113   EE aa 113   EE bb 252   EE bb 252   EE bb 252   FF aa 208   FF aa 208   FF aa 208   FF aa 208   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   GG aa 148   GG aa 148   GG aa 148   GG aa 148   GG bb 160   GG bb 160   GG bb 160   GG bb 160   HH aa 480   HH aa 480   HH aa 480   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 398   II aa 398   II bb 250   II bb 250   II bb 250   II bb 250   II bb 250   JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 257   JJ bb 257   JJ bb 257   JJ bb 257}

do_execsql_test 1.16.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058   AA bb 4113   AA bb 4376   BB aa 6578   BB aa 6680   BB aa 6928   BB aa 6941   BB aa 6947   BB aa 7093   BB bb 6500   BB bb 6548   BB bb 6554   BB bb 6629   BB bb 6635   BB bb 6707   CC aa 2363   CC aa 2515   CC aa 2692   CC aa 2964   CC bb 2300   CC bb 2776   DD aa 3187   DD aa 3776   DD aa 3808   DD bb 3073   DD bb 3238   DD bb 3316   DD bb 3794   EE aa 1762   EE aa 2426   EE bb 1771   EE bb 1910   EE bb 2287   FF aa 4998   FF aa 5001   FF aa 5050   FF aa 5460   FF bb 4730   FF bb 4798   FF bb 4942   FF bb 5094   FF bb 5373   FF bb 5566   GG aa 3834   GG aa 3988   GG aa 4133   GG aa 4320   GG bb 3530   GG bb 3539   GG bb 3624   GG bb 4308   HH aa 4464   HH aa 4653   HH aa 4963   HH bb 4480   HH bb 4713   HH bb 4760   HH bb 5088   HH bb 5113   HH bb 5310   II aa 2988   II aa 3242   II bb 2835   II bb 2969   II bb 3197   II bb 3219   II bb 3390   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 2961   JJ bb 3446   JJ bb 3464   JJ bb 3543}

do_execsql_test 1.16.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 1508   AA bb 1751   AA bb 1806   AA bb 2069   BB aa 2111   BB aa 2213   BB aa 2461   BB aa 2474   BB aa 2480   BB aa 2626   BB bb 3627   BB bb 3675   BB bb 3681   BB bb 3756   BB bb 3762   BB bb 3834   CC aa 1195   CC aa 1347   CC aa 1524   CC aa 1796   CC bb 346   CC bb 822   DD aa 480   DD aa 1069   DD aa 1101   DD bb 1748   DD bb 1913   DD bb 1991   DD bb 2469   EE aa 113   EE aa 777   EE bb 881   EE bb 1020   EE bb 1397   FF aa 1493   FF aa 1496   FF aa 1545   FF aa 1955   FF bb 2567   FF bb 2635   FF bb 2779   FF bb 2931   FF bb 3210   FF bb 3403   GG aa 963   GG aa 1117   GG aa 1262   GG aa 1449   GG bb 1933   GG bb 1942   GG bb 2027   GG bb 2711   HH aa 1270   HH aa 1459   HH aa 1769   HH bb 2231   HH bb 2464   HH bb 2511   HH bb 2839   HH bb 2864   HH bb 3061   II aa 398   II aa 652   II bb 1785   II bb 1919   II bb 2147   II bb 2169   II bb 2340   JJ aa 1115   JJ aa 1246   JJ aa 1780   JJ aa 1901   JJ bb 947   JJ bb 1432   JJ bb 1450   JJ bb 1529}

do_execsql_test 1.17.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.17.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.17.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.17.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.17.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.17.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.17.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}   AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}   CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}   DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}   EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}   GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}   HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}   II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.18.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 22701   AA aa 22701   AA aa 22701   AA aa 22701   AA bb 22701   AA bb 22701   AA bb 22701   AA bb 22701   BB aa 19829   BB aa 19829   BB aa 19829   BB aa 19829   BB aa 19829   BB aa 19829   BB bb 19829   BB bb 19829   BB bb 19829   BB bb 19829   BB bb 19829   BB bb 19829   CC aa 22150   CC aa 22150   CC aa 22150   CC aa 22150   CC bb 22150   CC bb 22150   DD aa 21758   DD aa 21758   DD aa 21758   DD bb 21758   DD bb 21758   DD bb 21758   DD bb 21758   EE aa 23019   EE aa 23019   EE bb 23019   EE bb 23019   EE bb 23019   FF aa 17351   FF aa 17351   FF aa 17351   FF aa 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   GG aa 12883   GG aa 12883   GG aa 12883   GG aa 12883   GG bb 12883   GG bb 12883   GG bb 12883   GG bb 12883   HH aa 7440   HH aa 7440   HH aa 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 3800   II aa 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.18.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 12840   AA aa 12840   AA aa 12840   AA aa 12840   AA bb 11787   AA bb 11787   AA bb 11787   AA bb 11787   BB aa 11621   BB aa 11621   BB aa 11621   BB aa 11621   BB aa 11621   BB aa 11621   BB bb 8044   BB bb 8044   BB bb 8044   BB bb 8044   BB bb 8044   BB bb 8044   CC aa 7739   CC aa 7739   CC aa 7739   CC aa 7739   CC bb 8734   CC bb 8734   DD aa 10914   DD aa 10914   DD aa 10914   DD bb 9804   DD bb 9804   DD bb 9804   DD bb 9804   EE aa 11785   EE aa 11785   EE bb 12385   EE bb 12385   EE bb 12385   FF aa 13416   FF aa 13416   FF aa 13416   FF aa 13416   FF bb 10961   FF bb 10961   FF bb 10961   FF bb 10961   FF bb 10961   FF bb 10961   GG aa 11954   GG aa 11954   GG aa 11954   GG aa 11954   GG bb 11097   GG bb 11097   GG bb 11097   GG bb 11097   HH aa 10634   HH aa 10634   HH aa 10634   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 6390   II aa 6390   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.18.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.18.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 870   AA aa 870   AA aa 870   AA aa 870   AA bb 845   AA bb 845   AA bb 845   AA bb 845   BB aa 959   BB aa 959   BB aa 959   BB aa 959   BB aa 959   BB aa 959   BB bb 959   BB bb 959   BB bb 959   BB bb 959   BB bb 959   BB bb 959   CC aa 959   CC aa 959   CC aa 959   CC aa 959   CC bb 959   CC bb 959   DD aa 959   DD aa 959   DD aa 959   DD bb 938   DD bb 938   DD bb 938   DD bb 938   EE aa 938   EE aa 938   EE bb 979   EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979   GG bb 979   GG bb 979   HH aa 963   HH aa 963   HH aa 963   HH bb 899   HH bb 899   HH bb 899   HH bb 899   HH bb 899   HH bb 899   II aa 899   II aa 899   II bb 899   II bb 899   II bb 899   II bb 899   II bb 899   JJ aa 839   JJ aa 839   JJ aa 839   JJ aa 839   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.18.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 158   AA aa 158   AA aa 158   AA aa 158   AA bb 158   AA bb 158   AA bb 158   AA bb 158   BB aa 158   BB aa 158   BB aa 158   BB aa 158   BB aa 158   BB aa 158   BB bb 113   BB bb 113   BB bb 113   BB bb 113   BB bb 113   BB bb 113   CC aa 113   CC aa 113   CC aa 113   CC aa 113   CC bb 113   CC bb 113   DD aa 102   DD aa 102   DD aa 102   DD bb 102   DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102   EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102   FF bb 133   FF bb 133   FF bb 133   FF bb 133   FF bb 133   FF bb 133   GG aa 133   GG aa 133   GG aa 133   GG aa 133   GG bb 113   GG bb 113   GG bb 113   GG bb 113   HH aa 113   HH aa 113   HH aa 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   II aa 113   II aa 113   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113   JJ aa 257   JJ aa 257   JJ aa 257   JJ aa 257   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.18.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 22701   AA aa 22701   AA aa 22701   AA aa 22701   AA bb 22701   AA bb 22701   AA bb 22701   AA bb 22701   BB aa 19829   BB aa 19829   BB aa 19829   BB aa 19829   BB aa 19829   BB aa 19829   BB bb 19829   BB bb 19829   BB bb 19829   BB bb 19829   BB bb 19829   BB bb 19829   CC aa 22150   CC aa 22150   CC aa 22150   CC aa 22150   CC bb 22150   CC bb 22150   DD aa 21758   DD aa 21758   DD aa 21758   DD bb 21758   DD bb 21758   DD bb 21758   DD bb 21758   EE aa 23019   EE aa 23019   EE bb 23019   EE bb 23019   EE bb 23019   FF aa 17351   FF aa 17351   FF aa 17351   FF aa 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   GG aa 12883   GG aa 12883   GG aa 12883   GG aa 12883   GG bb 12883   GG bb 12883   GG bb 12883   GG bb 12883   HH aa 7440   HH aa 7440   HH aa 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 3800   II aa 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.18.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 12840   AA aa 12840   AA aa 12840   AA aa 12840   AA bb 11787   AA bb 11787   AA bb 11787   AA bb 11787   BB aa 11621   BB aa 11621   BB aa 11621   BB aa 11621   BB aa 11621   BB aa 11621   BB bb 8044   BB bb 8044   BB bb 8044   BB bb 8044   BB bb 8044   BB bb 8044   CC aa 7739   CC aa 7739   CC aa 7739   CC aa 7739   CC bb 8734   CC bb 8734   DD aa 10914   DD aa 10914   DD aa 10914   DD bb 9804   DD bb 9804   DD bb 9804   DD bb 9804   EE aa 11785   EE aa 11785   EE bb 12385   EE bb 12385   EE bb 12385   FF aa 13416   FF aa 13416   FF aa 13416   FF aa 13416   FF bb 10961   FF bb 10961   FF bb 10961   FF bb 10961   FF bb 10961   FF bb 10961   GG aa 11954   GG aa 11954   GG aa 11954   GG aa 11954   GG bb 11097   GG bb 11097   GG bb 11097   GG bb 11097   HH aa 10634   HH aa 10634   HH aa 10634   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 6390   II aa 6390   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.19.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 40052   AA aa 40052   AA aa 40052   AA aa 40052   AA bb 40052   AA bb 40052   AA bb 40052   AA bb 40052   BB aa 32712   BB aa 32712   BB aa 32712   BB aa 32712   BB aa 32712   BB aa 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   CC aa 29590   CC aa 29590   CC aa 29590   CC aa 29590   CC bb 29590   CC bb 29590   DD aa 25558   DD aa 25558   DD aa 25558   DD bb 25558   DD bb 25558   DD bb 25558   DD bb 25558   EE aa 23019   EE aa 23019   EE bb 23019   EE bb 23019   EE bb 23019   FF aa 17351   FF aa 17351   FF aa 17351   FF aa 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   GG aa 12883   GG aa 12883   GG aa 12883   GG aa 12883   GG bb 12883   GG bb 12883   GG bb 12883   GG bb 12883   HH aa 7440   HH aa 7440   HH aa 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 3800   II aa 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.19.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 42430   AA aa 42430   AA aa 42430   AA aa 42430   AA bb 40052   AA bb 40052   AA bb 40052   AA bb 40052   BB aa 37179   BB aa 37179   BB aa 37179   BB aa 37179   BB aa 37179   BB aa 37179   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   CC aa 30758   CC aa 30758   CC aa 30758   CC aa 30758   CC bb 29590   CC bb 29590   DD aa 28265   DD aa 28265   DD aa 28265   DD bb 25558   DD bb 25558   DD bb 25558   DD bb 25558   EE aa 24668   EE aa 24668   EE bb 23019   EE bb 23019   EE bb 23019   FF aa 20856   FF aa 20856   FF aa 20856   FF aa 20856   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   GG aa 15754   GG aa 15754   GG aa 15754   GG aa 15754   GG bb 12883   GG bb 12883   GG bb 12883   GG bb 12883   HH aa 10634   HH aa 10634   HH aa 10634   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 6390   II aa 6390   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.19.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1   AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21   CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27   DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34   EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49   GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49   HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66   II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73   JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.19.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 979   AA aa 979   AA aa 979   AA aa 979   AA bb 979   AA bb 979   AA bb 979   AA bb 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979   CC aa 979   CC aa 979   CC aa 979   CC aa 979   CC bb 979   CC bb 979   DD aa 979   DD aa 979   DD aa 979   DD bb 979   DD bb 979   DD bb 979   DD bb 979   EE aa 979   EE aa 979   EE bb 979   EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979   GG bb 979   GG bb 979   HH aa 963   HH aa 963   HH aa 963   HH bb 899   HH bb 899   HH bb 899   HH bb 899   HH bb 899   HH bb 899   II aa 899   II aa 899   II bb 899   II bb 899   II bb 899   II bb 899   II bb 899   JJ aa 839   JJ aa 839   JJ aa 839   JJ aa 839   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.19.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 102   AA aa 102   AA aa 102   AA aa 102   AA bb 102   AA bb 102   AA bb 102   AA bb 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102   CC aa 102   CC aa 102   CC aa 102   CC aa 102   CC bb 102   CC bb 102   DD aa 102   DD aa 102   DD aa 102   DD bb 102   DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102   EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102   FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   GG aa 113   GG aa 113   GG aa 113   GG aa 113   GG bb 113   GG bb 113   GG bb 113   GG bb 113   HH aa 113   HH aa 113   HH aa 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   II aa 113   II aa 113   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113   JJ aa 257   JJ aa 257   JJ aa 257   JJ aa 257   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.19.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 40052   AA aa 40052   AA aa 40052   AA aa 40052   AA bb 40052   AA bb 40052   AA bb 40052   AA bb 40052   BB aa 32712   BB aa 32712   BB aa 32712   BB aa 32712   BB aa 32712   BB aa 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   CC aa 29590   CC aa 29590   CC aa 29590   CC aa 29590   CC bb 29590   CC bb 29590   DD aa 25558   DD aa 25558   DD aa 25558   DD bb 25558   DD bb 25558   DD bb 25558   DD bb 25558   EE aa 23019   EE aa 23019   EE bb 23019   EE bb 23019   EE bb 23019   FF aa 17351   FF aa 17351   FF aa 17351   FF aa 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   GG aa 12883   GG aa 12883   GG aa 12883   GG aa 12883   GG bb 12883   GG bb 12883   GG bb 12883   GG bb 12883   HH aa 7440   HH aa 7440   HH aa 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 3800   II aa 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.19.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 42430   AA aa 42430   AA aa 42430   AA aa 42430   AA bb 40052   AA bb 40052   AA bb 40052   AA bb 40052   BB aa 37179   BB aa 37179   BB aa 37179   BB aa 37179   BB aa 37179   BB aa 37179   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   CC aa 30758   CC aa 30758   CC aa 30758   CC aa 30758   CC bb 29590   CC bb 29590   DD aa 28265   DD aa 28265   DD aa 28265   DD bb 25558   DD bb 25558   DD bb 25558   DD bb 25558   EE aa 24668   EE aa 24668   EE bb 23019   EE bb 23019   EE bb 23019   FF aa 20856   FF aa 20856   FF aa 20856   FF aa 20856   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   FF bb 17351   GG aa 15754   GG aa 15754   GG aa 15754   GG aa 15754   GG bb 12883   GG bb 12883   GG bb 12883   GG bb 12883   HH aa 10634   HH aa 10634   HH aa 10634   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 6390   II aa 6390   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ bb {}   JJ bb {}   JJ bb {}   JJ bb {}}































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































do_execsql_test 2.1.1 {
  SELECT row_number() OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE NO OTHERS 
    )
} {1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56   57   58   59   60   61   62   63   64   65   66   67   68   69   70   71   72   73   74   75   76   77   78   79   80}






do_execsql_test 2.1.2 {
  SELECT nth_value(c, 14) OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE NO OTHERS 
    )
} {247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247}































do_execsql_test 2.2.1 {
  SELECT row_number() OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW 
    )
} {1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56   57   58   59   60   61   62   63   64   65   66   67   68   69   70   71   72   73   74   75   76   77   78   79   80}






do_execsql_test 2.2.2 {
  SELECT nth_value(c, 14) OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW 
    )
} {250   250   250   250   250   250   250   250   250   250   250   250   250   250   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247}































do_execsql_test 2.3.1 {
  SELECT row_number() OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE GROUP 
    )
} {1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56   57   58   59   60   61   62   63   64   65   66   67   68   69   70   71   72   73   74   75   76   77   78   79   80}






do_execsql_test 2.3.2 {
  SELECT nth_value(c, 14) OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE GROUP 
    )
} {250   250   250   250   250   250   250   250   250   250   250   250   250   250   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247}































do_execsql_test 2.4.1 {
  SELECT row_number() OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE TIES 
    )
} {1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56   57   58   59   60   61   62   63   64   65   66   67   68   69   70   71   72   73   74   75   76   77   78   79   80}






do_execsql_test 2.4.2 {
  SELECT nth_value(c, 14) OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE TIES 
    )
} {247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247   247}































#==========================================================================

do_execsql_test 3.0 {
  DROP TABLE IF EXISTS t1;
  CREATE TABLE t1(a REAL, b INTEGER);
  INSERT INTO t1 VALUES
................................................................................
do_execsql_test 3.11 {
  SELECT CAST(a AS INTEGER), sum(b) OVER win FROM t1 WINDOW win AS ( ORDER BY a DESC RANGE BETWEEN UNBOUNDED PRECEDING AND 5.9 PRECEDING )
} {30 {}   22 90   20 90   15 170   13 210   13 210   10 210   5 292}

do_execsql_test 3.12 {
  SELECT CAST(a AS INTEGER), sum(b) OVER win FROM t1 WINDOW win AS ( ORDER BY a DESC RANGE BETWEEN 2.1 FOLLOWING AND UNBOUNDED FOLLOWING )
} {30 232   22 112   20 112   15 30   13 30   13 30   10 10   5 {}}
















finish_test







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|
>
>
>
>
>








|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|
>
>
>
>
>








|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|
>
>
>
>
>








|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|
>
>
>
>
>








|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
....
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
    ('HH', 'bb', 133), ('EE', 'bb', 252), ('II', 'bb', 805), 
    ('BB', 'bb', 786), ('EE', 'bb', 768), ('HH', 'bb', 683), 
    ('DD', 'bb', 238), ('DD', 'aa', 256);
} {}

do_execsql_test 1.1.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685
  BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025
  CC bb 12025   CC bb 12025   DD aa 15147   DD aa 15147   DD aa 15147
  DD bb 15147   DD bb 15147   DD bb 15147   DD bb 15147   EE aa 19179
  EE aa 19179   EE bb 19179   EE bb 19179   EE bb 19179   FF aa 21718
  FF aa 21718   FF aa 21718   FF aa 21718   FF bb 21718   FF bb 21718
  FF bb 21718   FF bb 21718   FF bb 21718   FF bb 21718   GG aa 27386
  GG aa 27386   GG aa 27386   GG aa 27386   GG bb 27386   GG bb 27386
  GG bb 27386   GG bb 27386   HH aa 31854   HH aa 31854   HH aa 31854
  HH bb 31854   HH bb 31854   HH bb 31854   HH bb 31854   HH bb 31854
  HH bb 31854   II aa 37297   II aa 37297   II bb 37297   II bb 37297
  II bb 37297   II bb 37297   II bb 37297   JJ aa 40937   JJ aa 40937
  JJ aa 40937   JJ aa 40937   JJ bb 40937   JJ bb 40937   JJ bb 40937
  JJ bb 40937}

do_execsql_test 1.1.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307
  AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB aa 4685   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558
  BB bb 7558   BB bb 7558   CC aa 12025   CC aa 12025   CC aa 12025
  CC aa 12025   CC bb 13979   CC bb 13979   DD aa 15147   DD aa 15147
  DD aa 15147   DD bb 16472   DD bb 16472   DD bb 16472   DD bb 16472
  EE aa 19179   EE aa 19179   EE bb 20069   EE bb 20069   EE bb 20069
  FF aa 21718   FF aa 21718   FF aa 21718   FF aa 21718   FF bb 23881
  FF bb 23881   FF bb 23881   FF bb 23881   FF bb 23881   FF bb 23881
  GG aa 27386   GG aa 27386   GG aa 27386   GG aa 27386   GG bb 28983
  GG bb 28983   GG bb 28983   GG bb 28983   HH aa 31854   HH aa 31854
  HH aa 31854   HH bb 34103   HH bb 34103   HH bb 34103   HH bb 34103
  HH bb 34103   HH bb 34103   II aa 37297   II aa 37297   II bb 38347
  II bb 38347   II bb 38347   II bb 38347   II bb 38347   JJ aa 40937
  JJ aa 40937   JJ aa 40937   JJ aa 40937   JJ bb 42951   JJ bb 42951
  JJ bb 42951   JJ bb 42951}

do_execsql_test 1.1.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.1.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 934   AA bb 934
  AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934
  BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934
  BB bb 934   BB bb 934   CC aa 934   CC aa 934   CC aa 934   CC aa 934
  CC bb 934   CC bb 934   DD aa 934   DD aa 934   DD aa 934   DD bb 934
  DD bb 934   DD bb 934   DD bb 934   EE aa 959   EE aa 959   EE bb 959
  EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959
  FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959
  GG aa 959   GG aa 959   GG aa 959   GG aa 959   GG bb 959   GG bb 959
  GG bb 959   GG bb 959   HH aa 959   HH aa 959   HH aa 959   HH bb 979
  HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979
  II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979
  JJ aa 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ bb 979   JJ bb 979
  JJ bb 979   JJ bb 979}

do_execsql_test 1.1.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 223   AA bb 223
  AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223
  BB aa 223   BB aa 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223
  BB bb 223   BB bb 223   CC aa 223   CC aa 223   CC aa 223   CC aa 223
  CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 158
  DD bb 158   DD bb 158   DD bb 158   EE aa 158   EE aa 158   EE bb 113
  EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113
  FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113
  GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102
  GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 102
  HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   II aa 102
  II aa 102   II bb 102   II bb 102   II bb 102   II bb 102   II bb 102
  JJ aa 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ bb 102   JJ bb 102
  JJ bb 102   JJ bb 102}

do_execsql_test 1.1.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685
  BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025
  CC bb 12025   CC bb 12025   DD aa 15147   DD aa 15147   DD aa 15147
  DD bb 15147   DD bb 15147   DD bb 15147   DD bb 15147   EE aa 19179
  EE aa 19179   EE bb 19179   EE bb 19179   EE bb 19179   FF aa 21718
  FF aa 21718   FF aa 21718   FF aa 21718   FF bb 21718   FF bb 21718
  FF bb 21718   FF bb 21718   FF bb 21718   FF bb 21718   GG aa 27386
  GG aa 27386   GG aa 27386   GG aa 27386   GG bb 27386   GG bb 27386
  GG bb 27386   GG bb 27386   HH aa 31854   HH aa 31854   HH aa 31854
  HH bb 31854   HH bb 31854   HH bb 31854   HH bb 31854   HH bb 31854
  HH bb 31854   II aa 37297   II aa 37297   II bb 37297   II bb 37297
  II bb 37297   II bb 37297   II bb 37297   JJ aa 40937   JJ aa 40937
  JJ aa 40937   JJ aa 40937   JJ bb 40937   JJ bb 40937   JJ bb 40937
  JJ bb 40937}

do_execsql_test 1.1.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307
  AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB aa 4685   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558
  BB bb 7558   BB bb 7558   CC aa 12025   CC aa 12025   CC aa 12025
  CC aa 12025   CC bb 13979   CC bb 13979   DD aa 15147   DD aa 15147
  DD aa 15147   DD bb 16472   DD bb 16472   DD bb 16472   DD bb 16472
  EE aa 19179   EE aa 19179   EE bb 20069   EE bb 20069   EE bb 20069
  FF aa 21718   FF aa 21718   FF aa 21718   FF aa 21718   FF bb 23881
  FF bb 23881   FF bb 23881   FF bb 23881   FF bb 23881   FF bb 23881
  GG aa 27386   GG aa 27386   GG aa 27386   GG aa 27386   GG bb 28983
  GG bb 28983   GG bb 28983   GG bb 28983   HH aa 31854   HH aa 31854
  HH aa 31854   HH bb 34103   HH bb 34103   HH bb 34103   HH bb 34103
  HH bb 34103   HH bb 34103   II aa 37297   II aa 37297   II bb 38347
  II bb 38347   II bb 38347   II bb 38347   II bb 38347   JJ aa 40937
  JJ aa 40937   JJ aa 40937   JJ aa 40937   JJ bb 42951   JJ bb 42951
  JJ bb 42951   JJ bb 42951}

do_execsql_test 1.2.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685
  AA bb 4685   AA bb 4685   BB aa 12025   BB aa 12025   BB aa 12025
  BB aa 12025   BB aa 12025   BB aa 12025   BB bb 12025   BB bb 12025
  BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 15147
  CC aa 15147   CC aa 15147   CC aa 15147   CC bb 15147   CC bb 15147
  DD aa 19179   DD aa 19179   DD aa 19179   DD bb 19179   DD bb 19179
  DD bb 19179   DD bb 19179   EE aa 21718   EE aa 21718   EE bb 21718
  EE bb 21718   EE bb 21718   FF aa 27386   FF aa 27386   FF aa 27386
  FF aa 27386   FF bb 27386   FF bb 27386   FF bb 27386   FF bb 27386
  FF bb 27386   FF bb 27386   GG aa 31854   GG aa 31854   GG aa 31854
  GG aa 31854   GG bb 31854   GG bb 31854   GG bb 31854   GG bb 31854
  HH aa 37297   HH aa 37297   HH aa 37297   HH bb 37297   HH bb 37297
  HH bb 37297   HH bb 37297   HH bb 37297   HH bb 37297   II aa 40937
  II aa 40937   II bb 40937   II bb 40937   II bb 40937   II bb 40937
  II bb 40937   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737
  JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.2.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 4685   AA bb 4685
  AA bb 4685   AA bb 4685   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558
  BB aa 7558   BB aa 7558   BB bb 12025   BB bb 12025   BB bb 12025
  BB bb 12025   BB bb 12025   BB bb 12025   CC aa 13979   CC aa 13979
  CC aa 13979   CC aa 13979   CC bb 15147   CC bb 15147   DD aa 16472
  DD aa 16472   DD aa 16472   DD bb 19179   DD bb 19179   DD bb 19179
  DD bb 19179   EE aa 20069   EE aa 20069   EE bb 21718   EE bb 21718
  EE bb 21718   FF aa 23881   FF aa 23881   FF aa 23881   FF aa 23881
  FF bb 27386   FF bb 27386   FF bb 27386   FF bb 27386   FF bb 27386
  FF bb 27386   GG aa 28983   GG aa 28983   GG aa 28983   GG aa 28983
  GG bb 31854   GG bb 31854   GG bb 31854   GG bb 31854   HH aa 34103
  HH aa 34103   HH aa 34103   HH bb 37297   HH bb 37297   HH bb 37297
  HH bb 37297   HH bb 37297   HH bb 37297   II aa 38347   II aa 38347
  II bb 40937   II bb 40937   II bb 40937   II bb 40937   II bb 40937
  JJ aa 42951   JJ aa 42951   JJ aa 42951   JJ aa 42951   JJ bb 44737
  JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.2.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.2.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 934   AA bb 934
  AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934
  BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934
  BB bb 934   BB bb 934   CC aa 934   CC aa 934   CC aa 934   CC aa 934
  CC bb 934   CC bb 934   DD aa 934   DD aa 934   DD aa 934   DD bb 959
  DD bb 959   DD bb 959   DD bb 959   EE aa 959   EE aa 959   EE bb 959
  EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959
  FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959
  GG aa 959   GG aa 959   GG aa 959   GG aa 959   GG bb 959   GG bb 959
  GG bb 959   GG bb 959   HH aa 979   HH aa 979   HH aa 979   HH bb 979
  HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979
  II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979
  JJ aa 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ bb 979   JJ bb 979
  JJ bb 979   JJ bb 979}

do_execsql_test 1.2.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 223   AA bb 223
  AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223
  BB aa 223   BB aa 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223
  BB bb 223   BB bb 223   CC aa 158   CC aa 158   CC aa 158   CC aa 158
  CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 158
  DD bb 158   DD bb 158   DD bb 158   EE aa 113   EE aa 113   EE bb 113
  EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102
  GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 102
  HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   II aa 102
  II aa 102   II bb 102   II bb 102   II bb 102   II bb 102   II bb 102
  JJ aa 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ bb 102   JJ bb 102
  JJ bb 102   JJ bb 102}

do_execsql_test 1.2.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058
  AA bb 4113   AA bb 4376   BB aa 11263   BB aa 11365   BB aa 11613
  BB aa 11626   BB aa 11632   BB aa 11778   BB bb 11185   BB bb 11233
  BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 14388
  CC aa 14540   CC aa 14717   CC aa 14989   CC bb 14325   CC bb 14801
  DD aa 18334   DD aa 18923   DD aa 18955   DD bb 18220   DD bb 18385
  DD bb 18463   DD bb 18941   EE aa 20941   EE aa 21605   EE bb 20950
  EE bb 21089   EE bb 21466   FF aa 26716   FF aa 26719   FF aa 26768
  FF aa 27178   FF bb 26448   FF bb 26516   FF bb 26660   FF bb 26812
  FF bb 27091   FF bb 27284   GG aa 31220   GG aa 31374   GG aa 31519
  GG aa 31706   GG bb 30916   GG bb 30925   GG bb 31010   GG bb 31694
  HH aa 36318   HH aa 36507   HH aa 36817   HH bb 36334   HH bb 36567
  HH bb 36614   HH bb 36942   HH bb 36967   HH bb 37164   II aa 40285
  II aa 40539   II bb 40132   II bb 40266   II bb 40494   II bb 40516
  II bb 40687   JJ aa 43838   JJ aa 43969   JJ aa 44503   JJ aa 44624
  JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.2.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 3815   AA bb 4058
  AA bb 4113   AA bb 4376   BB aa 6796   BB aa 6898   BB aa 7146   BB aa 7159
  BB aa 7165   BB aa 7311   BB bb 11185   BB bb 11233   BB bb 11239
  BB bb 11314   BB bb 11320   BB bb 11392   CC aa 13220   CC aa 13372
  CC aa 13549   CC aa 13821   CC bb 14325   CC bb 14801   DD aa 15627
  DD aa 16216   DD aa 16248   DD bb 18220   DD bb 18385   DD bb 18463
  DD bb 18941   EE aa 19292   EE aa 19956   EE bb 20950   EE bb 21089
  EE bb 21466   FF aa 23211   FF aa 23214   FF aa 23263   FF aa 23673
  FF bb 26448   FF bb 26516   FF bb 26660   FF bb 26812   FF bb 27091
  FF bb 27284   GG aa 28349   GG aa 28503   GG aa 28648   GG aa 28835
  GG bb 30916   GG bb 30925   GG bb 31010   GG bb 31694   HH aa 33124
  HH aa 33313   HH aa 33623   HH bb 36334   HH bb 36567   HH bb 36614
  HH bb 36942   HH bb 36967   HH bb 37164   II aa 37695   II aa 37949
  II bb 40132   II bb 40266   II bb 40494   II bb 40516   II bb 40687
  JJ aa 42052   JJ aa 42183   JJ aa 42717   JJ aa 42838   JJ bb 43898
  JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.3.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 12025   AA aa 12025   AA aa 12025   AA aa 12025   AA bb 12025
  AA bb 12025   AA bb 12025   AA bb 12025   BB aa 15147   BB aa 15147
  BB aa 15147   BB aa 15147   BB aa 15147   BB aa 15147   BB bb 15147
  BB bb 15147   BB bb 15147   BB bb 15147   BB bb 15147   BB bb 15147
  CC aa 19179   CC aa 19179   CC aa 19179   CC aa 19179   CC bb 19179
  CC bb 19179   DD aa 21718   DD aa 21718   DD aa 21718   DD bb 21718
  DD bb 21718   DD bb 21718   DD bb 21718   EE aa 27386   EE aa 27386
  EE bb 27386   EE bb 27386   EE bb 27386   FF aa 31854   FF aa 31854
  FF aa 31854   FF aa 31854   FF bb 31854   FF bb 31854   FF bb 31854
  FF bb 31854   FF bb 31854   FF bb 31854   GG aa 37297   GG aa 37297
  GG aa 37297   GG aa 37297   GG bb 37297   GG bb 37297   GG bb 37297
  GG bb 37297   HH aa 40937   HH aa 40937   HH aa 40937   HH bb 40937
  HH bb 40937   HH bb 40937   HH bb 40937   HH bb 40937   HH bb 40937
  II aa 44737   II aa 44737   II bb 44737   II bb 44737   II bb 44737
  II bb 44737   II bb 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737
  JJ aa 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.3.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 7558   AA bb 7558
  AA bb 7558   AA bb 7558   BB aa 12025   BB aa 12025   BB aa 12025
  BB aa 12025   BB aa 12025   BB aa 12025   BB bb 13979   BB bb 13979
  BB bb 13979   BB bb 13979   BB bb 13979   BB bb 13979   CC aa 15147
  CC aa 15147   CC aa 15147   CC aa 15147   CC bb 16472   CC bb 16472
  DD aa 19179   DD aa 19179   DD aa 19179   DD bb 20069   DD bb 20069
  DD bb 20069   DD bb 20069   EE aa 21718   EE aa 21718   EE bb 23881
  EE bb 23881   EE bb 23881   FF aa 27386   FF aa 27386   FF aa 27386
  FF aa 27386   FF bb 28983   FF bb 28983   FF bb 28983   FF bb 28983
  FF bb 28983   FF bb 28983   GG aa 31854   GG aa 31854   GG aa 31854
  GG aa 31854   GG bb 34103   GG bb 34103   GG bb 34103   GG bb 34103
  HH aa 37297   HH aa 37297   HH aa 37297   HH bb 38347   HH bb 38347
  HH bb 38347   HH bb 38347   HH bb 38347   HH bb 38347   II aa 40937
  II aa 40937   II bb 42951   II bb 42951   II bb 42951   II bb 42951
  II bb 42951   JJ aa 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737
  JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.3.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.3.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 934   AA bb 934
  AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934
  BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934
  BB bb 934   BB bb 934   CC aa 934   CC aa 934   CC aa 934   CC aa 934
  CC bb 934   CC bb 934   DD aa 959   DD aa 959   DD aa 959   DD bb 959
  DD bb 959   DD bb 959   DD bb 959   EE aa 959   EE aa 959   EE bb 959
  EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959
  FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959   FF bb 959
  GG aa 959   GG aa 959   GG aa 959   GG aa 959   GG bb 979   GG bb 979
  GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 979
  HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979
  II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979
  JJ aa 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ bb 979   JJ bb 979
  JJ bb 979   JJ bb 979}

do_execsql_test 1.3.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 223   AA bb 223
  AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223
  BB aa 223   BB aa 223   BB bb 158   BB bb 158   BB bb 158   BB bb 158
  BB bb 158   BB bb 158   CC aa 158   CC aa 158   CC aa 158   CC aa 158
  CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 113
  DD bb 113   DD bb 113   DD bb 113   EE aa 113   EE aa 113   EE bb 113
  EE bb 113   EE bb 113   FF aa 102   FF aa 102   FF aa 102   FF aa 102
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102
  GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 102
  HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   II aa 102
  II aa 102   II bb 102   II bb 102   II bb 102   II bb 102   II bb 102
  JJ aa 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ bb 102   JJ bb 102
  JJ bb 102   JJ bb 102}

do_execsql_test 1.3.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 11091   AA aa 11114   AA aa 11786   AA aa 11802   AA bb 11155
  AA bb 11398   AA bb 11453   AA bb 11716   BB aa 14385   BB aa 14487
  BB aa 14735   BB aa 14748   BB aa 14754   BB aa 14900   BB bb 14307
  BB bb 14355   BB bb 14361   BB bb 14436   BB bb 14442   BB bb 14514
  CC aa 18420   CC aa 18572   CC aa 18749   CC aa 19021   CC bb 18357
  CC bb 18833   DD aa 20873   DD aa 21462   DD aa 21494   DD bb 20759
  DD bb 20924   DD bb 21002   DD bb 21480   EE aa 26609   EE aa 27273
  EE bb 26618   EE bb 26757   EE bb 27134   FF aa 31184   FF aa 31187
  FF aa 31236   FF aa 31646   FF bb 30916   FF bb 30984   FF bb 31128
  FF bb 31280   FF bb 31559   FF bb 31752   GG aa 36663   GG aa 36817
  GG aa 36962   GG aa 37149   GG bb 36359   GG bb 36368   GG bb 36453
  GG bb 37137   HH aa 39958   HH aa 40147   HH aa 40457   HH bb 39974
  HH bb 40207   HH bb 40254   HH bb 40582   HH bb 40607   HH bb 40804
  II aa 44085   II aa 44339   II bb 43932   II bb 44066   II bb 44294
  II bb 44316   II bb 44487   JJ aa 43838   JJ aa 43969   JJ aa 44503
  JJ aa 44624   JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.3.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 6688   AA bb 6931
  AA bb 6986   AA bb 7249   BB aa 11263   BB aa 11365   BB aa 11613
  BB aa 11626   BB aa 11632   BB aa 11778   BB bb 13139   BB bb 13187
  BB bb 13193   BB bb 13268   BB bb 13274   BB bb 13346   CC aa 14388
  CC aa 14540   CC aa 14717   CC aa 14989   CC bb 15650   CC bb 16126
  DD aa 18334   DD aa 18923   DD aa 18955   DD bb 19110   DD bb 19275
  DD bb 19353   DD bb 19831   EE aa 20941   EE aa 21605   EE bb 23113
  EE bb 23252   EE bb 23629   FF aa 26716   FF aa 26719   FF aa 26768
  FF aa 27178   FF bb 28045   FF bb 28113   FF bb 28257   FF bb 28409
  FF bb 28688   FF bb 28881   GG aa 31220   GG aa 31374   GG aa 31519
  GG aa 31706   GG bb 33165   GG bb 33174   GG bb 33259   GG bb 33943
  HH aa 36318   HH aa 36507   HH aa 36817   HH bb 37384   HH bb 37617
  HH bb 37664   HH bb 37992   HH bb 38017   HH bb 38214   II aa 40285
  II aa 40539   II bb 42146   II bb 42280   II bb 42508   II bb 42530
  II bb 42701   JJ aa 43838   JJ aa 43969   JJ aa 44503   JJ aa 44624
  JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.4.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737
  AA bb 44737   AA bb 44737   AA bb 44737   BB aa 44737   BB aa 44737
  BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB bb 44737
  BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737
  CC aa 44737   CC aa 44737   CC aa 44737   CC aa 44737   CC bb 44737
  CC bb 44737   DD aa 44737   DD aa 44737   DD aa 44737   DD bb 44737
  DD bb 44737   DD bb 44737   DD bb 44737   EE aa 44737   EE aa 44737
  EE bb 44737   EE bb 44737   EE bb 44737   FF aa 44737   FF aa 44737
  FF aa 44737   FF aa 44737   FF bb 44737   FF bb 44737   FF bb 44737
  FF bb 44737   FF bb 44737   FF bb 44737   GG aa 44737   GG aa 44737
  GG aa 44737   GG aa 44737   GG bb 44737   GG bb 44737   GG bb 44737
  GG bb 44737   HH aa 44737   HH aa 44737   HH aa 44737   HH bb 44737
  HH bb 44737   HH bb 44737   HH bb 44737   HH bb 44737   HH bb 44737
  II aa 44737   II aa 44737   II bb 44737   II bb 44737   II bb 44737
  II bb 44737   II bb 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737
  JJ aa 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.4.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737
  AA bb 44737   AA bb 44737   AA bb 44737   BB aa 44737   BB aa 44737
  BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB bb 44737
  BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737
  CC aa 44737   CC aa 44737   CC aa 44737   CC aa 44737   CC bb 44737
  CC bb 44737   DD aa 44737   DD aa 44737   DD aa 44737   DD bb 44737
  DD bb 44737   DD bb 44737   DD bb 44737   EE aa 44737   EE aa 44737
  EE bb 44737   EE bb 44737   EE bb 44737   FF aa 44737   FF aa 44737
  FF aa 44737   FF aa 44737   FF bb 44737   FF bb 44737   FF bb 44737
  FF bb 44737   FF bb 44737   FF bb 44737   GG aa 44737   GG aa 44737
  GG aa 44737   GG aa 44737   GG bb 44737   GG bb 44737   GG bb 44737
  GG bb 44737   HH aa 44737   HH aa 44737   HH aa 44737   HH bb 44737
  HH bb 44737   HH bb 44737   HH bb 44737   HH bb 44737   HH bb 44737
  II aa 44737   II aa 44737   II bb 44737   II bb 44737   II bb 44737
  II bb 44737   II bb 44737   JJ aa 44737   JJ aa 44737   JJ aa 44737
  JJ aa 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737   JJ bb 44737}

do_execsql_test 1.4.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.4.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 979   AA aa 979   AA aa 979   AA aa 979   AA bb 979   AA bb 979
  AA bb 979   AA bb 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979
  BB aa 979   BB aa 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979
  BB bb 979   BB bb 979   CC aa 979   CC aa 979   CC aa 979   CC aa 979
  CC bb 979   CC bb 979   DD aa 979   DD aa 979   DD aa 979   DD bb 979
  DD bb 979   DD bb 979   DD bb 979   EE aa 979   EE aa 979   EE bb 979
  EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979
  FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979
  GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979
  GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 979
  HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979
  II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979
  JJ aa 979   JJ aa 979   JJ aa 979   JJ aa 979   JJ bb 979   JJ bb 979
  JJ bb 979   JJ bb 979}

do_execsql_test 1.4.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 102   AA aa 102   AA aa 102   AA aa 102   AA bb 102   AA bb 102
  AA bb 102   AA bb 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102
  BB aa 102   BB aa 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102
  BB bb 102   BB bb 102   CC aa 102   CC aa 102   CC aa 102   CC aa 102
  CC bb 102   CC bb 102   DD aa 102   DD aa 102   DD aa 102   DD bb 102
  DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102
  EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102
  GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 102
  HH bb 102   HH bb 102   HH bb 102   HH bb 102   HH bb 102   II aa 102
  II aa 102   II bb 102   II bb 102   II bb 102   II bb 102   II bb 102
  JJ aa 102   JJ aa 102   JJ aa 102   JJ aa 102   JJ bb 102   JJ bb 102
  JJ bb 102   JJ bb 102}

do_execsql_test 1.4.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867
  AA bb 44110   AA bb 44165   AA bb 44428   BB aa 43975   BB aa 44077
  BB aa 44325   BB aa 44338   BB aa 44344   BB aa 44490   BB bb 43897
  BB bb 43945   BB bb 43951   BB bb 44026   BB bb 44032   BB bb 44104
  CC aa 43978   CC aa 44130   CC aa 44307   CC aa 44579   CC bb 43915
  CC bb 44391   DD aa 43892   DD aa 44481   DD aa 44513   DD bb 43778
  DD bb 43943   DD bb 44021   DD bb 44499   EE aa 43960   EE aa 44624
  EE bb 43969   EE bb 44108   EE bb 44485   FF aa 44067   FF aa 44070
  FF aa 44119   FF aa 44529   FF bb 43799   FF bb 43867   FF bb 44011
  FF bb 44163   FF bb 44442   FF bb 44635   GG aa 44103   GG aa 44257
  GG aa 44402   GG aa 44589   GG bb 43799   GG bb 43808   GG bb 43893
  GG bb 44577   HH aa 43758   HH aa 43947   HH aa 44257   HH bb 43774
  HH bb 44007   HH bb 44054   HH bb 44382   HH bb 44407   HH bb 44604
  II aa 44085   II aa 44339   II bb 43932   II bb 44066   II bb 44294
  II bb 44316   II bb 44487   JJ aa 43838   JJ aa 43969   JJ aa 44503
  JJ aa 44624   JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.4.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867
  AA bb 44110   AA bb 44165   AA bb 44428   BB aa 43975   BB aa 44077
  BB aa 44325   BB aa 44338   BB aa 44344   BB aa 44490   BB bb 43897
  BB bb 43945   BB bb 43951   BB bb 44026   BB bb 44032   BB bb 44104
  CC aa 43978   CC aa 44130   CC aa 44307   CC aa 44579   CC bb 43915
  CC bb 44391   DD aa 43892   DD aa 44481   DD aa 44513   DD bb 43778
  DD bb 43943   DD bb 44021   DD bb 44499   EE aa 43960   EE aa 44624
  EE bb 43969   EE bb 44108   EE bb 44485   FF aa 44067   FF aa 44070
  FF aa 44119   FF aa 44529   FF bb 43799   FF bb 43867   FF bb 44011
  FF bb 44163   FF bb 44442   FF bb 44635   GG aa 44103   GG aa 44257
  GG aa 44402   GG aa 44589   GG bb 43799   GG bb 43808   GG bb 43893
  GG bb 44577   HH aa 43758   HH aa 43947   HH aa 44257   HH bb 43774
  HH bb 44007   HH bb 44054   HH bb 44382   HH bb 44407   HH bb 44604
  II aa 44085   II aa 44339   II bb 43932   II bb 44066   II bb 44294
  II bb 44316   II bb 44487   JJ aa 43838   JJ aa 43969   JJ aa 44503
  JJ aa 44624   JJ bb 43898   JJ bb 44383   JJ bb 44401   JJ bb 44480}

do_execsql_test 1.5.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.5.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.5.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.5.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.5.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.5.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.5.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 PRECEDING         AND 2 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.6.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685
  BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025
  CC bb 12025   CC bb 12025   DD aa 10462   DD aa 10462   DD aa 10462
  DD bb 10462   DD bb 10462   DD bb 10462   DD bb 10462   EE aa 7154
  EE aa 7154   EE bb 7154   EE bb 7154   EE bb 7154   FF aa 6571   FF aa 6571
  FF aa 6571   FF aa 6571   FF bb 6571   FF bb 6571   FF bb 6571   FF bb 6571
  FF bb 6571   FF bb 6571   GG aa 8207   GG aa 8207   GG aa 8207   GG aa 8207
  GG bb 8207   GG bb 8207   GG bb 8207   GG bb 8207   HH aa 10136
  HH aa 10136   HH aa 10136   HH bb 10136   HH bb 10136   HH bb 10136
  HH bb 10136   HH bb 10136   HH bb 10136   II aa 9911   II aa 9911
  II bb 9911   II bb 9911   II bb 9911   II bb 9911   II bb 9911   JJ aa 9083
  JJ aa 9083   JJ aa 9083   JJ aa 9083   JJ bb 9083   JJ bb 9083   JJ bb 9083
  JJ bb 9083}

do_execsql_test 1.6.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307
  AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB aa 4685   BB bb 5251   BB bb 5251   BB bb 5251   BB bb 5251
  BB bb 5251   BB bb 5251   CC aa 7340   CC aa 7340   CC aa 7340   CC aa 7340
  CC bb 6421   CC bb 6421   DD aa 3122   DD aa 3122   DD aa 3122   DD bb 2493
  DD bb 2493   DD bb 2493   DD bb 2493   EE aa 4032   EE aa 4032   EE bb 3597
  EE bb 3597   EE bb 3597   FF aa 2539   FF aa 2539   FF aa 2539   FF aa 2539
  FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812
  GG aa 5668   GG aa 5668   GG aa 5668   GG aa 5668   GG bb 5102   GG bb 5102
  GG bb 5102   GG bb 5102   HH aa 4468   HH aa 4468   HH aa 4468   HH bb 5120
  HH bb 5120   HH bb 5120   HH bb 5120   HH bb 5120   HH bb 5120   II aa 5443
  II aa 5443   II bb 4244   II bb 4244   II bb 4244   II bb 4244   II bb 4244
  JJ aa 3640   JJ aa 3640   JJ aa 3640   JJ aa 3640   JJ bb 4604   JJ bb 4604
  JJ bb 4604   JJ bb 4604}

do_execsql_test 1.6.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.6.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 934   AA bb 934
  AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934
  BB aa 934   BB aa 934   BB bb 870   BB bb 870   BB bb 870   BB bb 870
  BB bb 870   BB bb 870   CC aa 840   CC aa 840   CC aa 840   CC aa 840
  CC bb 840   CC bb 840   DD aa 822   DD aa 822   DD aa 822   DD bb 845
  DD bb 845   DD bb 845   DD bb 845   EE aa 959   EE aa 959   EE bb 959
  EE bb 959   EE bb 959   FF aa 777   FF aa 777   FF aa 777   FF aa 777
  FF bb 768   FF bb 768   FF bb 768   FF bb 768   FF bb 768   FF bb 768
  GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 938   GG bb 938
  GG bb 938   GG bb 938   HH aa 938   HH aa 938   HH aa 938   HH bb 979
  HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979
  II aa 979   II bb 963   II bb 963   II bb 963   II bb 963   II bb 963
  JJ aa 805   JJ aa 805   JJ aa 805   JJ aa 805   JJ bb 899   JJ bb 899
  JJ bb 899   JJ bb 899}

do_execsql_test 1.6.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 223   AA bb 223
  AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223
  BB aa 223   BB aa 223   BB bb 247   BB bb 247   BB bb 247   BB bb 247
  BB bb 247   BB bb 247   CC aa 247   CC aa 247   CC aa 247   CC aa 247
  CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 224
  DD bb 224   DD bb 224   DD bb 224   EE aa 224   EE aa 224   EE bb 113
  EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113
  FF bb 208   FF bb 208   FF bb 208   FF bb 208   FF bb 208   FF bb 208
  GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102
  GG bb 102   GG bb 102   HH aa 148   HH aa 148   HH aa 148   HH bb 160
  HH bb 160   HH bb 160   HH bb 160   HH bb 160   HH bb 160   II aa 133
  II aa 133   II bb 133   II bb 133   II bb 133   II bb 133   II bb 133
  JJ aa 250   JJ aa 250   JJ aa 250   JJ aa 250   JJ bb 113   JJ bb 113
  JJ bb 113   JJ bb 113}

do_execsql_test 1.6.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685
  BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025
  CC bb 12025   CC bb 12025   DD aa 10462   DD aa 10462   DD aa 10462
  DD bb 10462   DD bb 10462   DD bb 10462   DD bb 10462   EE aa 7154
  EE aa 7154   EE bb 7154   EE bb 7154   EE bb 7154   FF aa 6571   FF aa 6571
  FF aa 6571   FF aa 6571   FF bb 6571   FF bb 6571   FF bb 6571   FF bb 6571
  FF bb 6571   FF bb 6571   GG aa 8207   GG aa 8207   GG aa 8207   GG aa 8207
  GG bb 8207   GG bb 8207   GG bb 8207   GG bb 8207   HH aa 10136
  HH aa 10136   HH aa 10136   HH bb 10136   HH bb 10136   HH bb 10136
  HH bb 10136   HH bb 10136   HH bb 10136   II aa 9911   II aa 9911
  II bb 9911   II bb 9911   II bb 9911   II bb 9911   II bb 9911   JJ aa 9083
  JJ aa 9083   JJ aa 9083   JJ aa 9083   JJ bb 9083   JJ bb 9083   JJ bb 9083
  JJ bb 9083}

do_execsql_test 1.6.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307
  AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB aa 4685   BB bb 5251   BB bb 5251   BB bb 5251   BB bb 5251
  BB bb 5251   BB bb 5251   CC aa 7340   CC aa 7340   CC aa 7340   CC aa 7340
  CC bb 6421   CC bb 6421   DD aa 3122   DD aa 3122   DD aa 3122   DD bb 2493
  DD bb 2493   DD bb 2493   DD bb 2493   EE aa 4032   EE aa 4032   EE bb 3597
  EE bb 3597   EE bb 3597   FF aa 2539   FF aa 2539   FF aa 2539   FF aa 2539
  FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812   FF bb 3812
  GG aa 5668   GG aa 5668   GG aa 5668   GG aa 5668   GG bb 5102   GG bb 5102
  GG bb 5102   GG bb 5102   HH aa 4468   HH aa 4468   HH aa 4468   HH bb 5120
  HH bb 5120   HH bb 5120   HH bb 5120   HH bb 5120   HH bb 5120   II aa 5443
  II aa 5443   II bb 4244   II bb 4244   II bb 4244   II bb 4244   II bb 4244
  JJ aa 3640   JJ aa 3640   JJ aa 3640   JJ aa 3640   JJ bb 4604   JJ bb 4604
  JJ bb 4604   JJ bb 4604}

do_execsql_test 1.7.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685
  BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025
  CC bb 12025   CC bb 12025   DD aa 15147   DD aa 15147   DD aa 15147
  DD bb 15147   DD bb 15147   DD bb 15147   DD bb 15147   EE aa 14494
  EE aa 14494   EE bb 14494   EE bb 14494   EE bb 14494   FF aa 9693
  FF aa 9693   FF aa 9693   FF aa 9693   FF bb 9693   FF bb 9693   FF bb 9693
  FF bb 9693   FF bb 9693   FF bb 9693   GG aa 12239   GG aa 12239
  GG aa 12239   GG aa 12239   GG bb 12239   GG bb 12239   GG bb 12239
  GG bb 12239   HH aa 12675   HH aa 12675   HH aa 12675   HH bb 12675
  HH bb 12675   HH bb 12675   HH bb 12675   HH bb 12675   HH bb 12675
  II aa 15579   II aa 15579   II bb 15579   II bb 15579   II bb 15579
  II bb 15579   II bb 15579   JJ aa 13551   JJ aa 13551   JJ aa 13551
  JJ aa 13551   JJ bb 13551   JJ bb 13551   JJ bb 13551   JJ bb 13551}

do_execsql_test 1.7.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307
  AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB aa 4685   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558
  BB bb 7558   BB bb 7558   CC aa 9718   CC aa 9718   CC aa 9718   CC aa 9718
  CC bb 9294   CC bb 9294   DD aa 7589   DD aa 7589   DD aa 7589   DD bb 4447
  DD bb 4447   DD bb 4447   DD bb 4447   EE aa 5200   EE aa 5200   EE bb 4922
  EE bb 4922   EE bb 4922   FF aa 5246   FF aa 5246   FF aa 5246   FF aa 5246
  FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702
  GG aa 7317   GG aa 7317   GG aa 7317   GG aa 7317   GG bb 7265   GG bb 7265
  GG bb 7265   GG bb 7265   HH aa 7973   HH aa 7973   HH aa 7973   HH bb 6717
  HH bb 6717   HH bb 6717   HH bb 6717   HH bb 6717   HH bb 6717   II aa 8314
  II aa 8314   II bb 6493   II bb 6493   II bb 6493   II bb 6493   II bb 6493
  JJ aa 6834   JJ aa 6834   JJ aa 6834   JJ aa 6834   JJ bb 5654   JJ bb 5654
  JJ bb 5654   JJ bb 5654}

do_execsql_test 1.7.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.7.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 934   AA bb 934
  AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934
  BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934
  BB bb 934   BB bb 934   CC aa 870   CC aa 870   CC aa 870   CC aa 870
  CC bb 840   CC bb 840   DD aa 840   DD aa 840   DD aa 840   DD bb 845
  DD bb 845   DD bb 845   DD bb 845   EE aa 959   EE aa 959   EE bb 959
  EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959
  FF bb 777   FF bb 777   FF bb 777   FF bb 777   FF bb 777   FF bb 777
  GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 938   GG bb 938
  GG bb 938   GG bb 938   HH aa 938   HH aa 938   HH aa 938   HH bb 979
  HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979
  II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979
  JJ aa 963   JJ aa 963   JJ aa 963   JJ aa 963   JJ bb 899   JJ bb 899
  JJ bb 899   JJ bb 899}

do_execsql_test 1.7.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 223   AA bb 223
  AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223
  BB aa 223   BB aa 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223
  BB bb 223   BB bb 223   CC aa 247   CC aa 247   CC aa 247   CC aa 247
  CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 158
  DD bb 158   DD bb 158   DD bb 158   EE aa 224   EE aa 224   EE bb 113
  EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113
  FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113
  GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102
  GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 148
  HH bb 148   HH bb 148   HH bb 148   HH bb 148   HH bb 148   II aa 133
  II aa 133   II bb 133   II bb 133   II bb 133   II bb 133   II bb 133
  JJ aa 133   JJ aa 133   JJ aa 133   JJ aa 133   JJ bb 113   JJ bb 113
  JJ bb 113   JJ bb 113}

do_execsql_test 1.7.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685   BB bb 4685
  BB bb 4685   CC aa 12025   CC aa 12025   CC aa 12025   CC aa 12025
  CC bb 12025   CC bb 12025   DD aa 15147   DD aa 15147   DD aa 15147
  DD bb 15147   DD bb 15147   DD bb 15147   DD bb 15147   EE aa 14494
  EE aa 14494   EE bb 14494   EE bb 14494   EE bb 14494   FF aa 9693
  FF aa 9693   FF aa 9693   FF aa 9693   FF bb 9693   FF bb 9693   FF bb 9693
  FF bb 9693   FF bb 9693   FF bb 9693   GG aa 12239   GG aa 12239
  GG aa 12239   GG aa 12239   GG bb 12239   GG bb 12239   GG bb 12239
  GG bb 12239   HH aa 12675   HH aa 12675   HH aa 12675   HH bb 12675
  HH bb 12675   HH bb 12675   HH bb 12675   HH bb 12675   HH bb 12675
  II aa 15579   II aa 15579   II bb 15579   II bb 15579   II bb 15579
  II bb 15579   II bb 15579   JJ aa 13551   JJ aa 13551   JJ aa 13551
  JJ aa 13551   JJ bb 13551   JJ bb 13551   JJ bb 13551   JJ bb 13551}

do_execsql_test 1.7.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 1 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb 2307   AA bb 2307
  AA bb 2307   AA bb 2307   BB aa 4685   BB aa 4685   BB aa 4685   BB aa 4685
  BB aa 4685   BB aa 4685   BB bb 7558   BB bb 7558   BB bb 7558   BB bb 7558
  BB bb 7558   BB bb 7558   CC aa 9718   CC aa 9718   CC aa 9718   CC aa 9718
  CC bb 9294   CC bb 9294   DD aa 7589   DD aa 7589   DD aa 7589   DD bb 4447
  DD bb 4447   DD bb 4447   DD bb 4447   EE aa 5200   EE aa 5200   EE bb 4922
  EE bb 4922   EE bb 4922   FF aa 5246   FF aa 5246   FF aa 5246   FF aa 5246
  FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702   FF bb 4702
  GG aa 7317   GG aa 7317   GG aa 7317   GG aa 7317   GG bb 7265   GG bb 7265
  GG bb 7265   GG bb 7265   HH aa 7973   HH aa 7973   HH aa 7973   HH bb 6717
  HH bb 6717   HH bb 6717   HH bb 6717   HH bb 6717   HH bb 6717   II aa 8314
  II aa 8314   II bb 6493   II bb 6493   II bb 6493   II bb 6493   II bb 6493
  JJ aa 6834   JJ aa 6834   JJ aa 6834   JJ aa 6834   JJ bb 5654   JJ bb 5654
  JJ bb 5654   JJ bb 5654}

do_execsql_test 1.8.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685
  AA bb 4685   AA bb 4685   BB aa 12025   BB aa 12025   BB aa 12025
  BB aa 12025   BB aa 12025   BB aa 12025   BB bb 12025   BB bb 12025
  BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 15147
  CC aa 15147   CC aa 15147   CC aa 15147   CC bb 15147   CC bb 15147
  DD aa 19179   DD aa 19179   DD aa 19179   DD bb 19179   DD bb 19179
  DD bb 19179   DD bb 19179   EE aa 17033   EE aa 17033   EE bb 17033
  EE bb 17033   EE bb 17033   FF aa 15361   FF aa 15361   FF aa 15361
  FF aa 15361   FF bb 15361   FF bb 15361   FF bb 15361   FF bb 15361
  FF bb 15361   FF bb 15361   GG aa 16707   GG aa 16707   GG aa 16707
  GG aa 16707   GG bb 16707   GG bb 16707   GG bb 16707   GG bb 16707
  HH aa 18118   HH aa 18118   HH aa 18118   HH bb 18118   HH bb 18118
  HH bb 18118   HH bb 18118   HH bb 18118   HH bb 18118   II aa 19219
  II aa 19219   II bb 19219   II bb 19219   II bb 19219   II bb 19219
  II bb 19219   JJ aa 17351   JJ aa 17351   JJ aa 17351   JJ aa 17351
  JJ bb 17351   JJ bb 17351   JJ bb 17351   JJ bb 17351}

do_execsql_test 1.8.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 4685   AA bb 4685
  AA bb 4685   AA bb 4685   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558
  BB aa 7558   BB aa 7558   BB bb 12025   BB bb 12025   BB bb 12025
  BB bb 12025   BB bb 12025   BB bb 12025   CC aa 11672   CC aa 11672
  CC aa 11672   CC aa 11672   CC bb 10462   CC bb 10462   DD aa 8914
  DD aa 8914   DD aa 8914   DD bb 7154   DD bb 7154   DD bb 7154   DD bb 7154
  EE aa 6090   EE aa 6090   EE bb 6571   EE bb 6571   EE bb 6571   FF aa 7409
  FF aa 7409   FF aa 7409   FF aa 7409   FF bb 8207   FF bb 8207   FF bb 8207
  FF bb 8207   FF bb 8207   FF bb 8207   GG aa 8914   GG aa 8914   GG aa 8914
  GG aa 8914   GG bb 10136   GG bb 10136   GG bb 10136   GG bb 10136
  HH aa 10222   HH aa 10222   HH aa 10222   HH bb 9911   HH bb 9911
  HH bb 9911   HH bb 9911   HH bb 9911   HH bb 9911   II aa 9364   II aa 9364
  II bb 9083   II bb 9083   II bb 9083   II bb 9083   II bb 9083   JJ aa 8848
  JJ aa 8848   JJ aa 8848   JJ aa 8848   JJ bb 7440   JJ bb 7440   JJ bb 7440
  JJ bb 7440}

do_execsql_test 1.8.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.8.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 934   AA bb 934
  AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934
  BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934
  BB bb 934   BB bb 934   CC aa 870   CC aa 870   CC aa 870   CC aa 870
  CC bb 840   CC bb 840   DD aa 845   DD aa 845   DD aa 845   DD bb 959
  DD bb 959   DD bb 959   DD bb 959   EE aa 959   EE aa 959   EE bb 959
  EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959
  FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938
  GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 938   GG bb 938
  GG bb 938   GG bb 938   HH aa 979   HH aa 979   HH aa 979   HH bb 979
  HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979
  II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979
  JJ aa 963   JJ aa 963   JJ aa 963   JJ aa 963   JJ bb 899   JJ bb 899
  JJ bb 899   JJ bb 899}

do_execsql_test 1.8.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 223   AA bb 223
  AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223
  BB aa 223   BB aa 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223
  BB bb 223   BB bb 223   CC aa 158   CC aa 158   CC aa 158   CC aa 158
  CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 158
  DD bb 158   DD bb 158   DD bb 158   EE aa 113   EE aa 113   EE bb 113
  EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102
  GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 133
  HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 133
  II aa 133   II bb 133   II bb 133   II bb 133   II bb 133   II bb 133
  JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 113   JJ bb 113
  JJ bb 113   JJ bb 113}

do_execsql_test 1.8.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058
  AA bb 4113   AA bb 4376   BB aa 11263   BB aa 11365   BB aa 11613
  BB aa 11626   BB aa 11632   BB aa 11778   BB bb 11185   BB bb 11233
  BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 14388
  CC aa 14540   CC aa 14717   CC aa 14989   CC bb 14325   CC bb 14801
  DD aa 18334   DD aa 18923   DD aa 18955   DD bb 18220   DD bb 18385
  DD bb 18463   DD bb 18941   EE aa 16256   EE aa 16920   EE bb 16265
  EE bb 16404   EE bb 16781   FF aa 14691   FF aa 14694   FF aa 14743
  FF aa 15153   FF bb 14423   FF bb 14491   FF bb 14635   FF bb 14787
  FF bb 15066   FF bb 15259   GG aa 16073   GG aa 16227   GG aa 16372
  GG aa 16559   GG bb 15769   GG bb 15778   GG bb 15863   GG bb 16547
  HH aa 17139   HH aa 17328   HH aa 17638   HH bb 17155   HH bb 17388
  HH bb 17435   HH bb 17763   HH bb 17788   HH bb 17985   II aa 18567
  II aa 18821   II bb 18414   II bb 18548   II bb 18776   II bb 18798
  II bb 18969   JJ aa 16452   JJ aa 16583   JJ aa 17117   JJ aa 17238
  JJ bb 16512   JJ bb 16997   JJ bb 17015   JJ bb 17094}

do_execsql_test 1.8.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 PRECEDING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 3815   AA bb 4058
  AA bb 4113   AA bb 4376   BB aa 6796   BB aa 6898   BB aa 7146   BB aa 7159
  BB aa 7165   BB aa 7311   BB bb 11185   BB bb 11233   BB bb 11239
  BB bb 11314   BB bb 11320   BB bb 11392   CC aa 10913   CC aa 11065
  CC aa 11242   CC aa 11514   CC bb 9640   CC bb 10116   DD aa 8069
  DD aa 8658   DD aa 8690   DD bb 6195   DD bb 6360   DD bb 6438   DD bb 6916
  EE aa 5313   EE aa 5977   EE bb 5803   EE bb 5942   EE bb 6319   FF aa 6739
  FF aa 6742   FF aa 6791   FF aa 7201   FF bb 7269   FF bb 7337   FF bb 7481
  FF bb 7633   FF bb 7912   FF bb 8105   GG aa 8280   GG aa 8434   GG aa 8579
  GG aa 8766   GG bb 9198   GG bb 9207   GG bb 9292   GG bb 9976   HH aa 9243
  HH aa 9432   HH aa 9742   HH bb 8948   HH bb 9181   HH bb 9228   HH bb 9556
  HH bb 9581   HH bb 9778   II aa 8712   II aa 8966   II bb 8278   II bb 8412
  II bb 8640   II bb 8662   II bb 8833   JJ aa 7949   JJ aa 8080   JJ aa 8614
  JJ aa 8735   JJ bb 6601   JJ bb 7086   JJ bb 7104   JJ bb 7183}

do_execsql_test 1.9.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685
  AA bb 4685   AA bb 4685   BB aa 12025   BB aa 12025   BB aa 12025
  BB aa 12025   BB aa 12025   BB aa 12025   BB bb 12025   BB bb 12025
  BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 15147
  CC aa 15147   CC aa 15147   CC aa 15147   CC bb 15147   CC bb 15147
  DD aa 14494   DD aa 14494   DD aa 14494   DD bb 14494   DD bb 14494
  DD bb 14494   DD bb 14494   EE aa 9693   EE aa 9693   EE bb 9693
  EE bb 9693   EE bb 9693   FF aa 12239   FF aa 12239   FF aa 12239
  FF aa 12239   FF bb 12239   FF bb 12239   FF bb 12239   FF bb 12239
  FF bb 12239   FF bb 12239   GG aa 12675   GG aa 12675   GG aa 12675
  GG aa 12675   GG bb 12675   GG bb 12675   GG bb 12675   GG bb 12675
  HH aa 15579   HH aa 15579   HH aa 15579   HH bb 15579   HH bb 15579
  HH bb 15579   HH bb 15579   HH bb 15579   HH bb 15579   II aa 13551
  II aa 13551   II bb 13551   II bb 13551   II bb 13551   II bb 13551
  II bb 13551   JJ aa 12883   JJ aa 12883   JJ aa 12883   JJ aa 12883
  JJ bb 12883   JJ bb 12883   JJ bb 12883   JJ bb 12883}

do_execsql_test 1.9.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 4685   AA bb 4685
  AA bb 4685   AA bb 4685   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558
  BB aa 7558   BB aa 7558   BB bb 9718   BB bb 9718   BB bb 9718   BB bb 9718
  BB bb 9718   BB bb 9718   CC aa 9294   CC aa 9294   CC aa 9294   CC aa 9294
  CC bb 7589   CC bb 7589   DD aa 4447   DD aa 4447   DD aa 4447   DD bb 5200
  DD bb 5200   DD bb 5200   DD bb 5200   EE aa 4922   EE aa 4922   EE bb 5246
  EE bb 5246   EE bb 5246   FF aa 4702   FF aa 4702   FF aa 4702   FF aa 4702
  FF bb 7317   FF bb 7317   FF bb 7317   FF bb 7317   FF bb 7317   FF bb 7317
  GG aa 7265   GG aa 7265   GG aa 7265   GG aa 7265   GG bb 7973   GG bb 7973
  GG bb 7973   GG bb 7973   HH aa 6717   HH aa 6717   HH aa 6717   HH bb 8314
  HH bb 8314   HH bb 8314   HH bb 8314   HH bb 8314   HH bb 8314   II aa 6493
  II aa 6493   II bb 6834   II bb 6834   II bb 6834   II bb 6834   II bb 6834
  JJ aa 5654   JJ aa 5654   JJ aa 5654   JJ aa 5654   JJ bb 6390   JJ bb 6390
  JJ bb 6390   JJ bb 6390}

do_execsql_test 1.9.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.9.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 934   AA bb 934
  AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934
  BB aa 934   BB aa 934   BB bb 870   BB bb 870   BB bb 870   BB bb 870
  BB bb 870   BB bb 870   CC aa 840   CC aa 840   CC aa 840   CC aa 840
  CC bb 840   CC bb 840   DD aa 845   DD aa 845   DD aa 845   DD bb 959
  DD bb 959   DD bb 959   DD bb 959   EE aa 959   EE aa 959   EE bb 959
  EE bb 959   EE bb 959   FF aa 777   FF aa 777   FF aa 777   FF aa 777
  FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938
  GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 938   GG bb 938
  GG bb 938   GG bb 938   HH aa 979   HH aa 979   HH aa 979   HH bb 979
  HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979
  II aa 979   II bb 963   II bb 963   II bb 963   II bb 963   II bb 963
  JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 899   JJ bb 899
  JJ bb 899   JJ bb 899}

do_execsql_test 1.9.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 223   AA bb 223
  AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223
  BB aa 223   BB aa 223   BB bb 247   BB bb 247   BB bb 247   BB bb 247
  BB bb 247   BB bb 247   CC aa 158   CC aa 158   CC aa 158   CC aa 158
  CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 224
  DD bb 224   DD bb 224   DD bb 224   EE aa 113   EE aa 113   EE bb 113
  EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102
  GG bb 102   GG bb 102   HH aa 148   HH aa 148   HH aa 148   HH bb 133
  HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 133
  II aa 133   II bb 133   II bb 133   II bb 133   II bb 133   II bb 133
  JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 113   JJ bb 113
  JJ bb 113   JJ bb 113}

do_execsql_test 1.9.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058
  AA bb 4113   AA bb 4376   BB aa 11263   BB aa 11365   BB aa 11613
  BB aa 11626   BB aa 11632   BB aa 11778   BB bb 11185   BB bb 11233
  BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 14388
  CC aa 14540   CC aa 14717   CC aa 14989   CC bb 14325   CC bb 14801
  DD aa 13649   DD aa 14238   DD aa 14270   DD bb 13535   DD bb 13700
  DD bb 13778   DD bb 14256   EE aa 8916   EE aa 9580   EE bb 8925
  EE bb 9064   EE bb 9441   FF aa 11569   FF aa 11572   FF aa 11621
  FF aa 12031   FF bb 11301   FF bb 11369   FF bb 11513   FF bb 11665
  FF bb 11944   FF bb 12137   GG aa 12041   GG aa 12195   GG aa 12340
  GG aa 12527   GG bb 11737   GG bb 11746   GG bb 11831   GG bb 12515
  HH aa 14600   HH aa 14789   HH aa 15099   HH bb 14616   HH bb 14849
  HH bb 14896   HH bb 15224   HH bb 15249   HH bb 15446   II aa 12899
  II aa 13153   II bb 12746   II bb 12880   II bb 13108   II bb 13130
  II bb 13301   JJ aa 11984   JJ aa 12115   JJ aa 12649   JJ aa 12770
  JJ bb 12044   JJ bb 12529   JJ bb 12547   JJ bb 12626}

do_execsql_test 1.9.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND CURRENT ROW  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 3815   AA bb 4058
  AA bb 4113   AA bb 4376   BB aa 6796   BB aa 6898   BB aa 7146   BB aa 7159
  BB aa 7165   BB aa 7311   BB bb 8878   BB bb 8926   BB bb 8932   BB bb 9007
  BB bb 9013   BB bb 9085   CC aa 8535   CC aa 8687   CC aa 8864   CC aa 9136
  CC bb 6767   CC bb 7243   DD aa 3602   DD aa 4191   DD aa 4223   DD bb 4241
  DD bb 4406   DD bb 4484   DD bb 4962   EE aa 4145   EE aa 4809   EE bb 4478
  EE bb 4617   EE bb 4994   FF aa 4032   FF aa 4035   FF aa 4084   FF aa 4494
  FF bb 6379   FF bb 6447   FF bb 6591   FF bb 6743   FF bb 7022   FF bb 7215
  GG aa 6631   GG aa 6785   GG aa 6930   GG aa 7117   GG bb 7035   GG bb 7044
  GG bb 7129   GG bb 7813   HH aa 5738   HH aa 5927   HH aa 6237   HH bb 7351
  HH bb 7584   HH bb 7631   HH bb 7959   HH bb 7984   HH bb 8181   II aa 5841
  II aa 6095   II bb 6029   II bb 6163   II bb 6391   II bb 6413   II bb 6584
  JJ aa 4755   JJ aa 4886   JJ aa 5420   JJ aa 5541   JJ bb 5551   JJ bb 6036
  JJ bb 6054   JJ bb 6133}

do_execsql_test 1.10.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685
  AA bb 4685   AA bb 4685   BB aa 12025   BB aa 12025   BB aa 12025
  BB aa 12025   BB aa 12025   BB aa 12025   BB bb 12025   BB bb 12025
  BB bb 12025   BB bb 12025   BB bb 12025   BB bb 12025   CC aa 15147
  CC aa 15147   CC aa 15147   CC aa 15147   CC bb 15147   CC bb 15147
  DD aa 19179   DD aa 19179   DD aa 19179   DD bb 19179   DD bb 19179
  DD bb 19179   DD bb 19179   EE aa 17033   EE aa 17033   EE bb 17033
  EE bb 17033   EE bb 17033   FF aa 15361   FF aa 15361   FF aa 15361
  FF aa 15361   FF bb 15361   FF bb 15361   FF bb 15361   FF bb 15361
  FF bb 15361   FF bb 15361   GG aa 16707   GG aa 16707   GG aa 16707
  GG aa 16707   GG bb 16707   GG bb 16707   GG bb 16707   GG bb 16707
  HH aa 18118   HH aa 18118   HH aa 18118   HH bb 18118   HH bb 18118
  HH bb 18118   HH bb 18118   HH bb 18118   HH bb 18118   II aa 19219
  II aa 19219   II bb 19219   II bb 19219   II bb 19219   II bb 19219
  II bb 19219   JJ aa 17351   JJ aa 17351   JJ aa 17351   JJ aa 17351
  JJ bb 17351   JJ bb 17351   JJ bb 17351   JJ bb 17351}

do_execsql_test 1.10.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 4685   AA bb 4685
  AA bb 4685   AA bb 4685   BB aa 7558   BB aa 7558   BB aa 7558   BB aa 7558
  BB aa 7558   BB aa 7558   BB bb 12025   BB bb 12025   BB bb 12025
  BB bb 12025   BB bb 12025   BB bb 12025   CC aa 11672   CC aa 11672
  CC aa 11672   CC aa 11672   CC bb 10462   CC bb 10462   DD aa 8914
  DD aa 8914   DD aa 8914   DD bb 7154   DD bb 7154   DD bb 7154   DD bb 7154
  EE aa 6090   EE aa 6090   EE bb 6571   EE bb 6571   EE bb 6571   FF aa 7409
  FF aa 7409   FF aa 7409   FF aa 7409   FF bb 8207   FF bb 8207   FF bb 8207
  FF bb 8207   FF bb 8207   FF bb 8207   GG aa 8914   GG aa 8914   GG aa 8914
  GG aa 8914   GG bb 10136   GG bb 10136   GG bb 10136   GG bb 10136
  HH aa 10222   HH aa 10222   HH aa 10222   HH bb 9911   HH bb 9911
  HH bb 9911   HH bb 9911   HH bb 9911   HH bb 9911   II aa 9364   II aa 9364
  II bb 9083   II bb 9083   II bb 9083   II bb 9083   II bb 9083   JJ aa 8848
  JJ aa 8848   JJ aa 8848   JJ aa 8848   JJ bb 7440   JJ bb 7440   JJ bb 7440
  JJ bb 7440}

do_execsql_test 1.10.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.10.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 934   AA bb 934
  AA bb 934   AA bb 934   BB aa 934   BB aa 934   BB aa 934   BB aa 934
  BB aa 934   BB aa 934   BB bb 934   BB bb 934   BB bb 934   BB bb 934
  BB bb 934   BB bb 934   CC aa 870   CC aa 870   CC aa 870   CC aa 870
  CC bb 840   CC bb 840   DD aa 845   DD aa 845   DD aa 845   DD bb 959
  DD bb 959   DD bb 959   DD bb 959   EE aa 959   EE aa 959   EE bb 959
  EE bb 959   EE bb 959   FF aa 959   FF aa 959   FF aa 959   FF aa 959
  FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938
  GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 938   GG bb 938
  GG bb 938   GG bb 938   HH aa 979   HH aa 979   HH aa 979   HH bb 979
  HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979
  II aa 979   II bb 979   II bb 979   II bb 979   II bb 979   II bb 979
  JJ aa 963   JJ aa 963   JJ aa 963   JJ aa 963   JJ bb 899   JJ bb 899
  JJ bb 899   JJ bb 899}

do_execsql_test 1.10.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 223   AA bb 223
  AA bb 223   AA bb 223   BB aa 223   BB aa 223   BB aa 223   BB aa 223
  BB aa 223   BB aa 223   BB bb 223   BB bb 223   BB bb 223   BB bb 223
  BB bb 223   BB bb 223   CC aa 158   CC aa 158   CC aa 158   CC aa 158
  CC bb 158   CC bb 158   DD aa 158   DD aa 158   DD aa 158   DD bb 158
  DD bb 158   DD bb 158   DD bb 158   EE aa 113   EE aa 113   EE bb 113
  EE bb 113   EE bb 113   FF aa 113   FF aa 113   FF aa 113   FF aa 113
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102
  GG bb 102   GG bb 102   HH aa 102   HH aa 102   HH aa 102   HH bb 133
  HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 133
  II aa 133   II bb 133   II bb 133   II bb 133   II bb 133   II bb 133
  JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 113   JJ bb 113
  JJ bb 113   JJ bb 113}

do_execsql_test 1.10.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058
  AA bb 4113   AA bb 4376   BB aa 11263   BB aa 11365   BB aa 11613
  BB aa 11626   BB aa 11632   BB aa 11778   BB bb 11185   BB bb 11233
  BB bb 11239   BB bb 11314   BB bb 11320   BB bb 11392   CC aa 14388
  CC aa 14540   CC aa 14717   CC aa 14989   CC bb 14325   CC bb 14801
  DD aa 18334   DD aa 18923   DD aa 18955   DD bb 18220   DD bb 18385
  DD bb 18463   DD bb 18941   EE aa 16256   EE aa 16920   EE bb 16265
  EE bb 16404   EE bb 16781   FF aa 14691   FF aa 14694   FF aa 14743
  FF aa 15153   FF bb 14423   FF bb 14491   FF bb 14635   FF bb 14787
  FF bb 15066   FF bb 15259   GG aa 16073   GG aa 16227   GG aa 16372
  GG aa 16559   GG bb 15769   GG bb 15778   GG bb 15863   GG bb 16547
  HH aa 17139   HH aa 17328   HH aa 17638   HH bb 17155   HH bb 17388
  HH bb 17435   HH bb 17763   HH bb 17788   HH bb 17985   II aa 18567
  II aa 18821   II bb 18414   II bb 18548   II bb 18776   II bb 18798
  II bb 18969   JJ aa 16452   JJ aa 16583   JJ aa 17117   JJ aa 17238
  JJ bb 16512   JJ bb 16997   JJ bb 17015   JJ bb 17094}

do_execsql_test 1.10.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 3 PRECEDING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 3815   AA bb 4058
  AA bb 4113   AA bb 4376   BB aa 6796   BB aa 6898   BB aa 7146   BB aa 7159
  BB aa 7165   BB aa 7311   BB bb 11185   BB bb 11233   BB bb 11239
  BB bb 11314   BB bb 11320   BB bb 11392   CC aa 10913   CC aa 11065
  CC aa 11242   CC aa 11514   CC bb 9640   CC bb 10116   DD aa 8069
  DD aa 8658   DD aa 8690   DD bb 6195   DD bb 6360   DD bb 6438   DD bb 6916
  EE aa 5313   EE aa 5977   EE bb 5803   EE bb 5942   EE bb 6319   FF aa 6739
  FF aa 6742   FF aa 6791   FF aa 7201   FF bb 7269   FF bb 7337   FF bb 7481
  FF bb 7633   FF bb 7912   FF bb 8105   GG aa 8280   GG aa 8434   GG aa 8579
  GG aa 8766   GG bb 9198   GG bb 9207   GG bb 9292   GG bb 9976   HH aa 9243
  HH aa 9432   HH aa 9742   HH bb 8948   HH bb 9181   HH bb 9228   HH bb 9556
  HH bb 9581   HH bb 9778   II aa 8712   II aa 8966   II bb 8278   II bb 8412
  II bb 8640   II bb 8662   II bb 8833   JJ aa 7949   JJ aa 8080   JJ aa 8614
  JJ aa 8735   JJ bb 6601   JJ bb 7086   JJ bb 7104   JJ bb 7183}

do_execsql_test 1.11.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737
  AA bb 44737   AA bb 44737   AA bb 44737   BB aa 44737   BB aa 44737
  BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB bb 44737
  BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737   BB bb 44737
  CC aa 44737   CC aa 44737   CC aa 44737   CC aa 44737   CC bb 44737
  CC bb 44737   DD aa 40052   DD aa 40052   DD aa 40052   DD bb 40052
  DD bb 40052   DD bb 40052   DD bb 40052   EE aa 32712   EE aa 32712
  EE bb 32712   EE bb 32712   EE bb 32712   FF aa 29590   FF aa 29590
  FF aa 29590   FF aa 29590   FF bb 29590   FF bb 29590   FF bb 29590
  FF bb 29590   FF bb 29590   FF bb 29590   GG aa 25558   GG aa 25558
  GG aa 25558   GG aa 25558   GG bb 25558   GG bb 25558   GG bb 25558
  GG bb 25558   HH aa 23019   HH aa 23019   HH aa 23019   HH bb 23019
  HH bb 23019   HH bb 23019   HH bb 23019   HH bb 23019   HH bb 23019
  II aa 17351   II aa 17351   II bb 17351   II bb 17351   II bb 17351
  II bb 17351   II bb 17351   JJ aa 12883   JJ aa 12883   JJ aa 12883
  JJ aa 12883   JJ bb 12883   JJ bb 12883   JJ bb 12883   JJ bb 12883}

do_execsql_test 1.11.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737
  AA bb 44737   AA bb 44737   AA bb 44737   BB aa 44737   BB aa 44737
  BB aa 44737   BB aa 44737   BB aa 44737   BB aa 44737   BB bb 42430
  BB bb 42430   BB bb 42430   BB bb 42430   BB bb 42430   BB bb 42430
  CC aa 40052   CC aa 40052   CC aa 40052   CC aa 40052   CC bb 37179
  CC bb 37179   DD aa 32712   DD aa 32712   DD aa 32712   DD bb 30758
  DD bb 30758   DD bb 30758   DD bb 30758   EE aa 29590   EE aa 29590
  EE bb 28265   EE bb 28265   EE bb 28265   FF aa 25558   FF aa 25558
  FF aa 25558   FF aa 25558   FF bb 24668   FF bb 24668   FF bb 24668
  FF bb 24668   FF bb 24668   FF bb 24668   GG aa 23019   GG aa 23019
  GG aa 23019   GG aa 23019   GG bb 20856   GG bb 20856   GG bb 20856
  GG bb 20856   HH aa 17351   HH aa 17351   HH aa 17351   HH bb 15754
  HH bb 15754   HH bb 15754   HH bb 15754   HH bb 15754   HH bb 15754
  II aa 12883   II aa 12883   II bb 10634   II bb 10634   II bb 10634
  II bb 10634   II bb 10634   JJ aa 7440   JJ aa 7440   JJ aa 7440
  JJ aa 7440   JJ bb 6390   JJ bb 6390   JJ bb 6390   JJ bb 6390}

do_execsql_test 1.11.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.11.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 979   AA aa 979   AA aa 979   AA aa 979   AA bb 979   AA bb 979
  AA bb 979   AA bb 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979
  BB aa 979   BB aa 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979
  BB bb 979   BB bb 979   CC aa 979   CC aa 979   CC aa 979   CC aa 979
  CC bb 979   CC bb 979   DD aa 979   DD aa 979   DD aa 979   DD bb 979
  DD bb 979   DD bb 979   DD bb 979   EE aa 979   EE aa 979   EE bb 979
  EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979
  FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979
  GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979
  GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 979
  HH bb 979   HH bb 979   HH bb 979   HH bb 979   HH bb 979   II aa 979
  II aa 979   II bb 963   II bb 963   II bb 963   II bb 963   II bb 963
  JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 899   JJ bb 899
  JJ bb 899   JJ bb 899}

do_execsql_test 1.11.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 102   AA aa 102   AA aa 102   AA aa 102   AA bb 102   AA bb 102
  AA bb 102   AA bb 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102
  BB aa 102   BB aa 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102
  BB bb 102   BB bb 102   CC aa 102   CC aa 102   CC aa 102   CC aa 102
  CC bb 102   CC bb 102   DD aa 102   DD aa 102   DD aa 102   DD bb 102
  DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102
  EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 102   GG aa 102   GG aa 102   GG aa 102   GG bb 102   GG bb 102
  GG bb 102   GG bb 102   HH aa 113   HH aa 113   HH aa 113   HH bb 113
  HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   II aa 113
  II aa 113   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113
  JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 113   JJ bb 113
  JJ bb 113   JJ bb 113}

do_execsql_test 1.11.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867
  AA bb 44110   AA bb 44165   AA bb 44428   BB aa 43975   BB aa 44077
  BB aa 44325   BB aa 44338   BB aa 44344   BB aa 44490   BB bb 43897
  BB bb 43945   BB bb 43951   BB bb 44026   BB bb 44032   BB bb 44104
  CC aa 43978   CC aa 44130   CC aa 44307   CC aa 44579   CC bb 43915
  CC bb 44391   DD aa 39207   DD aa 39796   DD aa 39828   DD bb 39093
  DD bb 39258   DD bb 39336   DD bb 39814   EE aa 31935   EE aa 32599
  EE bb 31944   EE bb 32083   EE bb 32460   FF aa 28920   FF aa 28923
  FF aa 28972   FF aa 29382   FF bb 28652   FF bb 28720   FF bb 28864
  FF bb 29016   FF bb 29295   FF bb 29488   GG aa 24924   GG aa 25078
  GG aa 25223   GG aa 25410   GG bb 24620   GG bb 24629   GG bb 24714
  GG bb 25398   HH aa 22040   HH aa 22229   HH aa 22539   HH bb 22056
  HH bb 22289   HH bb 22336   HH bb 22664   HH bb 22689   HH bb 22886
  II aa 16699   II aa 16953   II bb 16546   II bb 16680   II bb 16908
  II bb 16930   II bb 17101   JJ aa 11984   JJ aa 12115   JJ aa 12649
  JJ aa 12770   JJ bb 12044   JJ bb 12529   JJ bb 12547   JJ bb 12626}

do_execsql_test 1.11.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 2 PRECEDING         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867
  AA bb 44110   AA bb 44165   AA bb 44428   BB aa 43975   BB aa 44077
  BB aa 44325   BB aa 44338   BB aa 44344   BB aa 44490   BB bb 41590
  BB bb 41638   BB bb 41644   BB bb 41719   BB bb 41725   BB bb 41797
  CC aa 39293   CC aa 39445   CC aa 39622   CC aa 39894   CC bb 36357
  CC bb 36833   DD aa 31867   DD aa 32456   DD aa 32488   DD bb 29799
  DD bb 29964   DD bb 30042   DD bb 30520   EE aa 28813   EE aa 29477
  EE bb 27497   EE bb 27636   EE bb 28013   FF aa 24888   FF aa 24891
  FF aa 24940   FF aa 25350   FF bb 23730   FF bb 23798   FF bb 23942
  FF bb 24094   FF bb 24373   FF bb 24566   GG aa 22385   GG aa 22539
  GG aa 22684   GG aa 22871   GG bb 19918   GG bb 19927   GG bb 20012
  GG bb 20696   HH aa 16372   HH aa 16561   HH aa 16871   HH bb 14791
  HH bb 15024   HH bb 15071   HH bb 15399   HH bb 15424   HH bb 15621
  II aa 12231   II aa 12485   II bb 9829   II bb 9963   II bb 10191
  II bb 10213   II bb 10384   JJ aa 6541   JJ aa 6672   JJ aa 7206
  JJ aa 7327   JJ bb 5551   JJ bb 6036   JJ bb 6054   JJ bb 6133}

do_execsql_test 1.12.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685
  AA bb 4685   AA bb 4685   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340
  BB aa 7340   BB aa 7340   BB bb 7340   BB bb 7340   BB bb 7340   BB bb 7340
  BB bb 7340   BB bb 7340   CC aa 3122   CC aa 3122   CC aa 3122   CC aa 3122
  CC bb 3122   CC bb 3122   DD aa 4032   DD aa 4032   DD aa 4032   DD bb 4032
  DD bb 4032   DD bb 4032   DD bb 4032   EE aa 2539   EE aa 2539   EE bb 2539
  EE bb 2539   EE bb 2539   FF aa 5668   FF aa 5668   FF aa 5668   FF aa 5668
  FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668
  GG aa 4468   GG aa 4468   GG aa 4468   GG aa 4468   GG bb 4468   GG bb 4468
  GG bb 4468   GG bb 4468   HH aa 5443   HH aa 5443   HH aa 5443   HH bb 5443
  HH bb 5443   HH bb 5443   HH bb 5443   HH bb 5443   HH bb 5443   II aa 3640
  II aa 3640   II bb 3640   II bb 3640   II bb 3640   II bb 3640   II bb 3640
  JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 3800   JJ bb 3800
  JJ bb 3800   JJ bb 3800}

do_execsql_test 1.12.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 2378   AA bb 2378
  AA bb 2378   AA bb 2378   BB aa 2873   BB aa 2873   BB aa 2873   BB aa 2873
  BB aa 2873   BB aa 2873   BB bb 4467   BB bb 4467   BB bb 4467   BB bb 4467
  BB bb 4467   BB bb 4467   CC aa 1954   CC aa 1954   CC aa 1954   CC aa 1954
  CC bb 1168   CC bb 1168   DD aa 1325   DD aa 1325   DD aa 1325   DD bb 2707
  DD bb 2707   DD bb 2707   DD bb 2707   EE aa 890   EE aa 890   EE bb 1649
  EE bb 1649   EE bb 1649   FF aa 2163   FF aa 2163   FF aa 2163   FF aa 2163
  FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505
  GG aa 1597   GG aa 1597   GG aa 1597   GG aa 1597   GG bb 2871   GG bb 2871
  GG bb 2871   GG bb 2871   HH aa 2249   HH aa 2249   HH aa 2249   HH bb 3194
  HH bb 3194   HH bb 3194   HH bb 3194   HH bb 3194   HH bb 3194   II aa 1050
  II aa 1050   II bb 2590   II bb 2590   II bb 2590   II bb 2590   II bb 2590
  JJ aa 2014   JJ aa 2014   JJ aa 2014   JJ aa 2014   JJ bb 1786   JJ bb 1786
  JJ bb 1786   JJ bb 1786}

do_execsql_test 1.12.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.12.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 870   AA bb 870
  AA bb 870   AA bb 870   BB aa 762   BB aa 762   BB aa 762   BB aa 762
  BB aa 762   BB aa 762   BB bb 840   BB bb 840   BB bb 840   BB bb 840
  BB bb 840   BB bb 840   CC aa 759   CC aa 759   CC aa 759   CC aa 759
  CC bb 822   CC bb 822   DD aa 845   DD aa 845   DD aa 845   DD bb 959
  DD bb 959   DD bb 959   DD bb 959   EE aa 777   EE aa 777   EE bb 768
  EE bb 768   EE bb 768   FF aa 670   FF aa 670   FF aa 670   FF aa 670
  FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938
  GG aa 634   GG aa 634   GG aa 634   GG aa 634   GG bb 938   GG bb 938
  GG bb 938   GG bb 938   HH aa 979   HH aa 979   HH aa 979   HH bb 963
  HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   II aa 652
  II aa 652   II bb 805   II bb 805   II bb 805   II bb 805   II bb 805
  JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 839   JJ bb 839
  JJ bb 839   JJ bb 839}

do_execsql_test 1.12.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 309   AA bb 309
  AA bb 309   AA bb 309   BB aa 247   BB aa 247   BB aa 247   BB aa 247
  BB aa 247   BB aa 247   BB bb 633   BB bb 633   BB bb 633   BB bb 633
  BB bb 633   BB bb 633   CC aa 158   CC aa 158   CC aa 158   CC aa 158
  CC bb 346   CC bb 346   DD aa 224   DD aa 224   DD aa 224   DD bb 238
  DD bb 238   DD bb 238   DD bb 238   EE aa 113   EE aa 113   EE bb 252
  EE bb 252   EE bb 252   FF aa 208   FF aa 208   FF aa 208   FF aa 208
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 148   GG aa 148   GG aa 148   GG aa 148   GG bb 160   GG bb 160
  GG bb 160   GG bb 160   HH aa 480   HH aa 480   HH aa 480   HH bb 133
  HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 398
  II aa 398   II bb 250   II bb 250   II bb 250   II bb 250   II bb 250
  JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 257   JJ bb 257
  JJ bb 257   JJ bb 257}

do_execsql_test 1.12.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058
  AA bb 4113   AA bb 4376   BB aa 6578   BB aa 6680   BB aa 6928   BB aa 6941
  BB aa 6947   BB aa 7093   BB bb 6500   BB bb 6548   BB bb 6554   BB bb 6629
  BB bb 6635   BB bb 6707   CC aa 2363   CC aa 2515   CC aa 2692   CC aa 2964
  CC bb 2300   CC bb 2776   DD aa 3187   DD aa 3776   DD aa 3808   DD bb 3073
  DD bb 3238   DD bb 3316   DD bb 3794   EE aa 1762   EE aa 2426   EE bb 1771
  EE bb 1910   EE bb 2287   FF aa 4998   FF aa 5001   FF aa 5050   FF aa 5460
  FF bb 4730   FF bb 4798   FF bb 4942   FF bb 5094   FF bb 5373   FF bb 5566
  GG aa 3834   GG aa 3988   GG aa 4133   GG aa 4320   GG bb 3530   GG bb 3539
  GG bb 3624   GG bb 4308   HH aa 4464   HH aa 4653   HH aa 4963   HH bb 4480
  HH bb 4713   HH bb 4760   HH bb 5088   HH bb 5113   HH bb 5310   II aa 2988
  II aa 3242   II bb 2835   II bb 2969   II bb 3197   II bb 3219   II bb 3390
  JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 2961   JJ bb 3446
  JJ bb 3464   JJ bb 3543}

do_execsql_test 1.12.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 1508   AA bb 1751
  AA bb 1806   AA bb 2069   BB aa 2111   BB aa 2213   BB aa 2461   BB aa 2474
  BB aa 2480   BB aa 2626   BB bb 3627   BB bb 3675   BB bb 3681   BB bb 3756
  BB bb 3762   BB bb 3834   CC aa 1195   CC aa 1347   CC aa 1524   CC aa 1796
  CC bb 346   CC bb 822   DD aa 480   DD aa 1069   DD aa 1101   DD bb 1748
  DD bb 1913   DD bb 1991   DD bb 2469   EE aa 113   EE aa 777   EE bb 881
  EE bb 1020   EE bb 1397   FF aa 1493   FF aa 1496   FF aa 1545   FF aa 1955
  FF bb 2567   FF bb 2635   FF bb 2779   FF bb 2931   FF bb 3210   FF bb 3403
  GG aa 963   GG aa 1117   GG aa 1262   GG aa 1449   GG bb 1933   GG bb 1942
  GG bb 2027   GG bb 2711   HH aa 1270   HH aa 1459   HH aa 1769   HH bb 2231
  HH bb 2464   HH bb 2511   HH bb 2839   HH bb 2864   HH bb 3061   II aa 398
  II aa 652   II bb 1785   II bb 1919   II bb 2147   II bb 2169   II bb 2340
  JJ aa 1115   JJ aa 1246   JJ aa 1780   JJ aa 1901   JJ bb 947   JJ bb 1432
  JJ bb 1450   JJ bb 1529}

do_execsql_test 1.13.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 12025   AA aa 12025   AA aa 12025   AA aa 12025   AA bb 12025
  AA bb 12025   AA bb 12025   AA bb 12025   BB aa 10462   BB aa 10462
  BB aa 10462   BB aa 10462   BB aa 10462   BB aa 10462   BB bb 10462
  BB bb 10462   BB bb 10462   BB bb 10462   BB bb 10462   BB bb 10462
  CC aa 7154   CC aa 7154   CC aa 7154   CC aa 7154   CC bb 7154   CC bb 7154
  DD aa 6571   DD aa 6571   DD aa 6571   DD bb 6571   DD bb 6571   DD bb 6571
  DD bb 6571   EE aa 8207   EE aa 8207   EE bb 8207   EE bb 8207   EE bb 8207
  FF aa 10136   FF aa 10136   FF aa 10136   FF aa 10136   FF bb 10136
  FF bb 10136   FF bb 10136   FF bb 10136   FF bb 10136   FF bb 10136
  GG aa 9911   GG aa 9911   GG aa 9911   GG aa 9911   GG bb 9911   GG bb 9911
  GG bb 9911   GG bb 9911   HH aa 9083   HH aa 9083   HH aa 9083   HH bb 9083
  HH bb 9083   HH bb 9083   HH bb 9083   HH bb 9083   HH bb 9083   II aa 7440
  II aa 7440   II bb 7440   II bb 7440   II bb 7440   II bb 7440   II bb 7440
  JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 3800   JJ bb 3800
  JJ bb 3800   JJ bb 3800}

do_execsql_test 1.13.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 5251   AA bb 5251
  AA bb 5251   AA bb 5251   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340
  BB aa 7340   BB aa 7340   BB bb 6421   BB bb 6421   BB bb 6421   BB bb 6421
  BB bb 6421   BB bb 6421   CC aa 3122   CC aa 3122   CC aa 3122   CC aa 3122
  CC bb 2493   CC bb 2493   DD aa 4032   DD aa 4032   DD aa 4032   DD bb 3597
  DD bb 3597   DD bb 3597   DD bb 3597   EE aa 2539   EE aa 2539   EE bb 3812
  EE bb 3812   EE bb 3812   FF aa 5668   FF aa 5668   FF aa 5668   FF aa 5668
  FF bb 5102   FF bb 5102   FF bb 5102   FF bb 5102   FF bb 5102   FF bb 5102
  GG aa 4468   GG aa 4468   GG aa 4468   GG aa 4468   GG bb 5120   GG bb 5120
  GG bb 5120   GG bb 5120   HH aa 5443   HH aa 5443   HH aa 5443   HH bb 4244
  HH bb 4244   HH bb 4244   HH bb 4244   HH bb 4244   HH bb 4244   II aa 3640
  II aa 3640   II bb 4604   II bb 4604   II bb 4604   II bb 4604   II bb 4604
  JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 1786   JJ bb 1786
  JJ bb 1786   JJ bb 1786}

do_execsql_test 1.13.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.13.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 870   AA bb 870
  AA bb 870   AA bb 870   BB aa 840   BB aa 840   BB aa 840   BB aa 840
  BB aa 840   BB aa 840   BB bb 840   BB bb 840   BB bb 840   BB bb 840
  BB bb 840   BB bb 840   CC aa 822   CC aa 822   CC aa 822   CC aa 822
  CC bb 845   CC bb 845   DD aa 959   DD aa 959   DD aa 959   DD bb 959
  DD bb 959   DD bb 959   DD bb 959   EE aa 777   EE aa 777   EE bb 768
  EE bb 768   EE bb 768   FF aa 938   FF aa 938   FF aa 938   FF aa 938
  FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938
  GG aa 938   GG aa 938   GG aa 938   GG aa 938   GG bb 979   GG bb 979
  GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 963
  HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   II aa 805
  II aa 805   II bb 899   II bb 899   II bb 899   II bb 899   II bb 899
  JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 839   JJ bb 839
  JJ bb 839   JJ bb 839}

do_execsql_test 1.13.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 247   AA bb 247
  AA bb 247   AA bb 247   BB aa 247   BB aa 247   BB aa 247   BB aa 247
  BB aa 247   BB aa 247   BB bb 158   BB bb 158   BB bb 158   BB bb 158
  BB bb 158   BB bb 158   CC aa 158   CC aa 158   CC aa 158   CC aa 158
  CC bb 224   CC bb 224   DD aa 224   DD aa 224   DD aa 224   DD bb 113
  DD bb 113   DD bb 113   DD bb 113   EE aa 113   EE aa 113   EE bb 208
  EE bb 208   EE bb 208   FF aa 102   FF aa 102   FF aa 102   FF aa 102
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 148   GG aa 148   GG aa 148   GG aa 148   GG bb 160   GG bb 160
  GG bb 160   GG bb 160   HH aa 133   HH aa 133   HH aa 133   HH bb 133
  HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 250
  II aa 250   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113
  JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 257   JJ bb 257
  JJ bb 257   JJ bb 257}

do_execsql_test 1.13.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 11091   AA aa 11114   AA aa 11786   AA aa 11802   AA bb 11155
  AA bb 11398   AA bb 11453   AA bb 11716   BB aa 9700   BB aa 9802
  BB aa 10050   BB aa 10063   BB aa 10069   BB aa 10215   BB bb 9622
  BB bb 9670   BB bb 9676   BB bb 9751   BB bb 9757   BB bb 9829   CC aa 6395
  CC aa 6547   CC aa 6724   CC aa 6996   CC bb 6332   CC bb 6808   DD aa 5726
  DD aa 6315   DD aa 6347   DD bb 5612   DD bb 5777   DD bb 5855   DD bb 6333
  EE aa 7430   EE aa 8094   EE bb 7439   EE bb 7578   EE bb 7955   FF aa 9466
  FF aa 9469   FF aa 9518   FF aa 9928   FF bb 9198   FF bb 9266   FF bb 9410
  FF bb 9562   FF bb 9841   FF bb 10034   GG aa 9277   GG aa 9431
  GG aa 9576   GG aa 9763   GG bb 8973   GG bb 8982   GG bb 9067   GG bb 9751
  HH aa 8104   HH aa 8293   HH aa 8603   HH bb 8120   HH bb 8353   HH bb 8400
  HH bb 8728   HH bb 8753   HH bb 8950   II aa 6788   II aa 7042   II bb 6635
  II bb 6769   II bb 6997   II bb 7019   II bb 7190   JJ aa 2901   JJ aa 3032
  JJ aa 3566   JJ aa 3687   JJ bb 2961   JJ bb 3446   JJ bb 3464   JJ bb 3543}

do_execsql_test 1.13.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 1 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 4381   AA bb 4624
  AA bb 4679   AA bb 4942   BB aa 6578   BB aa 6680   BB aa 6928   BB aa 6941
  BB aa 6947   BB aa 7093   BB bb 5581   BB bb 5629   BB bb 5635   BB bb 5710
  BB bb 5716   BB bb 5788   CC aa 2363   CC aa 2515   CC aa 2692   CC aa 2964
  CC bb 1671   CC bb 2147   DD aa 3187   DD aa 3776   DD aa 3808   DD bb 2638
  DD bb 2803   DD bb 2881   DD bb 3359   EE aa 1762   EE aa 2426   EE bb 3044
  EE bb 3183   EE bb 3560   FF aa 4998   FF aa 5001   FF aa 5050   FF aa 5460
  FF bb 4164   FF bb 4232   FF bb 4376   FF bb 4528   FF bb 4807   FF bb 5000
  GG aa 3834   GG aa 3988   GG aa 4133   GG aa 4320   GG bb 4182   GG bb 4191
  GG bb 4276   GG bb 4960   HH aa 4464   HH aa 4653   HH aa 4963   HH bb 3281
  HH bb 3514   HH bb 3561   HH bb 3889   HH bb 3914   HH bb 4111   II aa 2988
  II aa 3242   II bb 3799   II bb 3933   II bb 4161   II bb 4183   II bb 4354
  JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 947   JJ bb 1432
  JJ bb 1450   JJ bb 1529}

do_execsql_test 1.14.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737
  AA bb 44737   AA bb 44737   AA bb 44737   BB aa 40052   BB aa 40052
  BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB bb 40052
  BB bb 40052   BB bb 40052   BB bb 40052   BB bb 40052   BB bb 40052
  CC aa 32712   CC aa 32712   CC aa 32712   CC aa 32712   CC bb 32712
  CC bb 32712   DD aa 29590   DD aa 29590   DD aa 29590   DD bb 29590
  DD bb 29590   DD bb 29590   DD bb 29590   EE aa 25558   EE aa 25558
  EE bb 25558   EE bb 25558   EE bb 25558   FF aa 23019   FF aa 23019
  FF aa 23019   FF aa 23019   FF bb 23019   FF bb 23019   FF bb 23019
  FF bb 23019   FF bb 23019   FF bb 23019   GG aa 17351   GG aa 17351
  GG aa 17351   GG aa 17351   GG bb 17351   GG bb 17351   GG bb 17351
  GG bb 17351   HH aa 12883   HH aa 12883   HH aa 12883   HH bb 12883
  HH bb 12883   HH bb 12883   HH bb 12883   HH bb 12883   HH bb 12883
  II aa 7440   II aa 7440   II bb 7440   II bb 7440   II bb 7440   II bb 7440
  II bb 7440   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 3800
  JJ bb 3800   JJ bb 3800   JJ bb 3800}

do_execsql_test 1.14.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 42430
  AA bb 42430   AA bb 42430   AA bb 42430   BB aa 40052   BB aa 40052
  BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB bb 37179
  BB bb 37179   BB bb 37179   BB bb 37179   BB bb 37179   BB bb 37179
  CC aa 32712   CC aa 32712   CC aa 32712   CC aa 32712   CC bb 30758
  CC bb 30758   DD aa 29590   DD aa 29590   DD aa 29590   DD bb 28265
  DD bb 28265   DD bb 28265   DD bb 28265   EE aa 25558   EE aa 25558
  EE bb 24668   EE bb 24668   EE bb 24668   FF aa 23019   FF aa 23019
  FF aa 23019   FF aa 23019   FF bb 20856   FF bb 20856   FF bb 20856
  FF bb 20856   FF bb 20856   FF bb 20856   GG aa 17351   GG aa 17351
  GG aa 17351   GG aa 17351   GG bb 15754   GG bb 15754   GG bb 15754
  GG bb 15754   HH aa 12883   HH aa 12883   HH aa 12883   HH bb 10634
  HH bb 10634   HH bb 10634   HH bb 10634   HH bb 10634   HH bb 10634
  II aa 7440   II aa 7440   II bb 6390   II bb 6390   II bb 6390   II bb 6390
  II bb 6390   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 1786
  JJ bb 1786   JJ bb 1786   JJ bb 1786}

do_execsql_test 1.14.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.14.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 979   AA aa 979   AA aa 979   AA aa 979   AA bb 979   AA bb 979
  AA bb 979   AA bb 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979
  BB aa 979   BB aa 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979
  BB bb 979   BB bb 979   CC aa 979   CC aa 979   CC aa 979   CC aa 979
  CC bb 979   CC bb 979   DD aa 979   DD aa 979   DD aa 979   DD bb 979
  DD bb 979   DD bb 979   DD bb 979   EE aa 979   EE aa 979   EE bb 979
  EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979
  FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979
  GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979
  GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 963
  HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   II aa 899
  II aa 899   II bb 899   II bb 899   II bb 899   II bb 899   II bb 899
  JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 839   JJ bb 839
  JJ bb 839   JJ bb 839}

do_execsql_test 1.14.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 102   AA aa 102   AA aa 102   AA aa 102   AA bb 102   AA bb 102
  AA bb 102   AA bb 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102
  BB aa 102   BB aa 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102
  BB bb 102   BB bb 102   CC aa 102   CC aa 102   CC aa 102   CC aa 102
  CC bb 102   CC bb 102   DD aa 102   DD aa 102   DD aa 102   DD bb 102
  DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102
  EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 113   GG aa 113   GG aa 113   GG aa 113   GG bb 113   GG bb 113
  GG bb 113   GG bb 113   HH aa 113   HH aa 113   HH aa 113   HH bb 113
  HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   II aa 113
  II aa 113   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113
  JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 257   JJ bb 257
  JJ bb 257   JJ bb 257}

do_execsql_test 1.14.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867
  AA bb 44110   AA bb 44165   AA bb 44428   BB aa 39290   BB aa 39392
  BB aa 39640   BB aa 39653   BB aa 39659   BB aa 39805   BB bb 39212
  BB bb 39260   BB bb 39266   BB bb 39341   BB bb 39347   BB bb 39419
  CC aa 31953   CC aa 32105   CC aa 32282   CC aa 32554   CC bb 31890
  CC bb 32366   DD aa 28745   DD aa 29334   DD aa 29366   DD bb 28631
  DD bb 28796   DD bb 28874   DD bb 29352   EE aa 24781   EE aa 25445
  EE bb 24790   EE bb 24929   EE bb 25306   FF aa 22349   FF aa 22352
  FF aa 22401   FF aa 22811   FF bb 22081   FF bb 22149   FF bb 22293
  FF bb 22445   FF bb 22724   FF bb 22917   GG aa 16717   GG aa 16871
  GG aa 17016   GG aa 17203   GG bb 16413   GG bb 16422   GG bb 16507
  GG bb 17191   HH aa 11904   HH aa 12093   HH aa 12403   HH bb 11920
  HH bb 12153   HH bb 12200   HH bb 12528   HH bb 12553   HH bb 12750
  II aa 6788   II aa 7042   II bb 6635   II bb 6769   II bb 6997   II bb 7019
  II bb 7190   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 2961
  JJ bb 3446   JJ bb 3464   JJ bb 3543}

do_execsql_test 1.14.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND 100 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 41560
  AA bb 41803   AA bb 41858   AA bb 42121   BB aa 39290   BB aa 39392
  BB aa 39640   BB aa 39653   BB aa 39659   BB aa 39805   BB bb 36339
  BB bb 36387   BB bb 36393   BB bb 36468   BB bb 36474   BB bb 36546
  CC aa 31953   CC aa 32105   CC aa 32282   CC aa 32554   CC bb 29936
  CC bb 30412   DD aa 28745   DD aa 29334   DD aa 29366   DD bb 27306
  DD bb 27471   DD bb 27549   DD bb 28027   EE aa 24781   EE aa 25445
  EE bb 23900   EE bb 24039   EE bb 24416   FF aa 22349   FF aa 22352
  FF aa 22401   FF aa 22811   FF bb 19918   FF bb 19986   FF bb 20130
  FF bb 20282   FF bb 20561   FF bb 20754   GG aa 16717   GG aa 16871
  GG aa 17016   GG aa 17203   GG bb 14816   GG bb 14825   GG bb 14910
  GG bb 15594   HH aa 11904   HH aa 12093   HH aa 12403   HH bb 9671
  HH bb 9904   HH bb 9951   HH bb 10279   HH bb 10304   HH bb 10501
  II aa 6788   II aa 7042   II bb 5585   II bb 5719   II bb 5947   II bb 5969
  II bb 6140   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 947
  JJ bb 1432   JJ bb 1450   JJ bb 1529}

do_execsql_test 1.15.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 44737
  AA bb 44737   AA bb 44737   AA bb 44737   BB aa 40052   BB aa 40052
  BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB bb 40052
  BB bb 40052   BB bb 40052   BB bb 40052   BB bb 40052   BB bb 40052
  CC aa 32712   CC aa 32712   CC aa 32712   CC aa 32712   CC bb 32712
  CC bb 32712   DD aa 29590   DD aa 29590   DD aa 29590   DD bb 29590
  DD bb 29590   DD bb 29590   DD bb 29590   EE aa 25558   EE aa 25558
  EE bb 25558   EE bb 25558   EE bb 25558   FF aa 23019   FF aa 23019
  FF aa 23019   FF aa 23019   FF bb 23019   FF bb 23019   FF bb 23019
  FF bb 23019   FF bb 23019   FF bb 23019   GG aa 17351   GG aa 17351
  GG aa 17351   GG aa 17351   GG bb 17351   GG bb 17351   GG bb 17351
  GG bb 17351   HH aa 12883   HH aa 12883   HH aa 12883   HH bb 12883
  HH bb 12883   HH bb 12883   HH bb 12883   HH bb 12883   HH bb 12883
  II aa 7440   II aa 7440   II bb 7440   II bb 7440   II bb 7440   II bb 7440
  II bb 7440   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 3800
  JJ bb 3800   JJ bb 3800   JJ bb 3800}

do_execsql_test 1.15.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 44737   AA aa 44737   AA aa 44737   AA aa 44737   AA bb 42430
  AA bb 42430   AA bb 42430   AA bb 42430   BB aa 40052   BB aa 40052
  BB aa 40052   BB aa 40052   BB aa 40052   BB aa 40052   BB bb 37179
  BB bb 37179   BB bb 37179   BB bb 37179   BB bb 37179   BB bb 37179
  CC aa 32712   CC aa 32712   CC aa 32712   CC aa 32712   CC bb 30758
  CC bb 30758   DD aa 29590   DD aa 29590   DD aa 29590   DD bb 28265
  DD bb 28265   DD bb 28265   DD bb 28265   EE aa 25558   EE aa 25558
  EE bb 24668   EE bb 24668   EE bb 24668   FF aa 23019   FF aa 23019
  FF aa 23019   FF aa 23019   FF bb 20856   FF bb 20856   FF bb 20856
  FF bb 20856   FF bb 20856   FF bb 20856   GG aa 17351   GG aa 17351
  GG aa 17351   GG aa 17351   GG bb 15754   GG bb 15754   GG bb 15754
  GG bb 15754   HH aa 12883   HH aa 12883   HH aa 12883   HH bb 10634
  HH bb 10634   HH bb 10634   HH bb 10634   HH bb 10634   HH bb 10634
  II aa 7440   II aa 7440   II bb 6390   II bb 6390   II bb 6390   II bb 6390
  II bb 6390   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 1786
  JJ bb 1786   JJ bb 1786   JJ bb 1786}

do_execsql_test 1.15.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.15.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 979   AA aa 979   AA aa 979   AA aa 979   AA bb 979   AA bb 979
  AA bb 979   AA bb 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979
  BB aa 979   BB aa 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979
  BB bb 979   BB bb 979   CC aa 979   CC aa 979   CC aa 979   CC aa 979
  CC bb 979   CC bb 979   DD aa 979   DD aa 979   DD aa 979   DD bb 979
  DD bb 979   DD bb 979   DD bb 979   EE aa 979   EE aa 979   EE bb 979
  EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979
  FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979
  GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979
  GG bb 979   GG bb 979   HH aa 979   HH aa 979   HH aa 979   HH bb 963
  HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   II aa 899
  II aa 899   II bb 899   II bb 899   II bb 899   II bb 899   II bb 899
  JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 839   JJ bb 839
  JJ bb 839   JJ bb 839}

do_execsql_test 1.15.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 102   AA aa 102   AA aa 102   AA aa 102   AA bb 102   AA bb 102
  AA bb 102   AA bb 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102
  BB aa 102   BB aa 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102
  BB bb 102   BB bb 102   CC aa 102   CC aa 102   CC aa 102   CC aa 102
  CC bb 102   CC bb 102   DD aa 102   DD aa 102   DD aa 102   DD bb 102
  DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102
  EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 113   GG aa 113   GG aa 113   GG aa 113   GG bb 113   GG bb 113
  GG bb 113   GG bb 113   HH aa 113   HH aa 113   HH aa 113   HH bb 113
  HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   II aa 113
  II aa 113   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113
  JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 257   JJ bb 257
  JJ bb 257   JJ bb 257}

do_execsql_test 1.15.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 43867
  AA bb 44110   AA bb 44165   AA bb 44428   BB aa 39290   BB aa 39392
  BB aa 39640   BB aa 39653   BB aa 39659   BB aa 39805   BB bb 39212
  BB bb 39260   BB bb 39266   BB bb 39341   BB bb 39347   BB bb 39419
  CC aa 31953   CC aa 32105   CC aa 32282   CC aa 32554   CC bb 31890
  CC bb 32366   DD aa 28745   DD aa 29334   DD aa 29366   DD bb 28631
  DD bb 28796   DD bb 28874   DD bb 29352   EE aa 24781   EE aa 25445
  EE bb 24790   EE bb 24929   EE bb 25306   FF aa 22349   FF aa 22352
  FF aa 22401   FF aa 22811   FF bb 22081   FF bb 22149   FF bb 22293
  FF bb 22445   FF bb 22724   FF bb 22917   GG aa 16717   GG aa 16871
  GG aa 17016   GG aa 17203   GG bb 16413   GG bb 16422   GG bb 16507
  GG bb 17191   HH aa 11904   HH aa 12093   HH aa 12403   HH bb 11920
  HH bb 12153   HH bb 12200   HH bb 12528   HH bb 12553   HH bb 12750
  II aa 6788   II aa 7042   II bb 6635   II bb 6769   II bb 6997   II bb 7019
  II bb 7190   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 2961
  JJ bb 3446   JJ bb 3464   JJ bb 3543}

do_execsql_test 1.15.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 43803   AA aa 43826   AA aa 44498   AA aa 44514   AA bb 41560
  AA bb 41803   AA bb 41858   AA bb 42121   BB aa 39290   BB aa 39392
  BB aa 39640   BB aa 39653   BB aa 39659   BB aa 39805   BB bb 36339
  BB bb 36387   BB bb 36393   BB bb 36468   BB bb 36474   BB bb 36546
  CC aa 31953   CC aa 32105   CC aa 32282   CC aa 32554   CC bb 29936
  CC bb 30412   DD aa 28745   DD aa 29334   DD aa 29366   DD bb 27306
  DD bb 27471   DD bb 27549   DD bb 28027   EE aa 24781   EE aa 25445
  EE bb 23900   EE bb 24039   EE bb 24416   FF aa 22349   FF aa 22352
  FF aa 22401   FF aa 22811   FF bb 19918   FF bb 19986   FF bb 20130
  FF bb 20282   FF bb 20561   FF bb 20754   GG aa 16717   GG aa 16871
  GG aa 17016   GG aa 17203   GG bb 14816   GG bb 14825   GG bb 14910
  GG bb 15594   HH aa 11904   HH aa 12093   HH aa 12403   HH bb 9671
  HH bb 9904   HH bb 9951   HH bb 10279   HH bb 10304   HH bb 10501
  II aa 6788   II aa 7042   II bb 5585   II bb 5719   II bb 5947   II bb 5969
  II bb 6140   JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 947
  JJ bb 1432   JJ bb 1450   JJ bb 1529}

do_execsql_test 1.16.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 4685   AA aa 4685   AA aa 4685   AA aa 4685   AA bb 4685   AA bb 4685
  AA bb 4685   AA bb 4685   BB aa 7340   BB aa 7340   BB aa 7340   BB aa 7340
  BB aa 7340   BB aa 7340   BB bb 7340   BB bb 7340   BB bb 7340   BB bb 7340
  BB bb 7340   BB bb 7340   CC aa 3122   CC aa 3122   CC aa 3122   CC aa 3122
  CC bb 3122   CC bb 3122   DD aa 4032   DD aa 4032   DD aa 4032   DD bb 4032
  DD bb 4032   DD bb 4032   DD bb 4032   EE aa 2539   EE aa 2539   EE bb 2539
  EE bb 2539   EE bb 2539   FF aa 5668   FF aa 5668   FF aa 5668   FF aa 5668
  FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668   FF bb 5668
  GG aa 4468   GG aa 4468   GG aa 4468   GG aa 4468   GG bb 4468   GG bb 4468
  GG bb 4468   GG bb 4468   HH aa 5443   HH aa 5443   HH aa 5443   HH bb 5443
  HH bb 5443   HH bb 5443   HH bb 5443   HH bb 5443   HH bb 5443   II aa 3640
  II aa 3640   II bb 3640   II bb 3640   II bb 3640   II bb 3640   II bb 3640
  JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ aa 3800   JJ bb 3800   JJ bb 3800
  JJ bb 3800   JJ bb 3800}

do_execsql_test 1.16.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 2307   AA aa 2307   AA aa 2307   AA aa 2307   AA bb 2378   AA bb 2378
  AA bb 2378   AA bb 2378   BB aa 2873   BB aa 2873   BB aa 2873   BB aa 2873
  BB aa 2873   BB aa 2873   BB bb 4467   BB bb 4467   BB bb 4467   BB bb 4467
  BB bb 4467   BB bb 4467   CC aa 1954   CC aa 1954   CC aa 1954   CC aa 1954
  CC bb 1168   CC bb 1168   DD aa 1325   DD aa 1325   DD aa 1325   DD bb 2707
  DD bb 2707   DD bb 2707   DD bb 2707   EE aa 890   EE aa 890   EE bb 1649
  EE bb 1649   EE bb 1649   FF aa 2163   FF aa 2163   FF aa 2163   FF aa 2163
  FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505   FF bb 3505
  GG aa 1597   GG aa 1597   GG aa 1597   GG aa 1597   GG bb 2871   GG bb 2871
  GG bb 2871   GG bb 2871   HH aa 2249   HH aa 2249   HH aa 2249   HH bb 3194
  HH bb 3194   HH bb 3194   HH bb 3194   HH bb 3194   HH bb 3194   II aa 1050
  II aa 1050   II bb 2590   II bb 2590   II bb 2590   II bb 2590   II bb 2590
  JJ aa 2014   JJ aa 2014   JJ aa 2014   JJ aa 2014   JJ bb 1786   JJ bb 1786
  JJ bb 1786   JJ bb 1786}

do_execsql_test 1.16.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.16.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 934   AA aa 934   AA aa 934   AA aa 934   AA bb 870   AA bb 870
  AA bb 870   AA bb 870   BB aa 762   BB aa 762   BB aa 762   BB aa 762
  BB aa 762   BB aa 762   BB bb 840   BB bb 840   BB bb 840   BB bb 840
  BB bb 840   BB bb 840   CC aa 759   CC aa 759   CC aa 759   CC aa 759
  CC bb 822   CC bb 822   DD aa 845   DD aa 845   DD aa 845   DD bb 959
  DD bb 959   DD bb 959   DD bb 959   EE aa 777   EE aa 777   EE bb 768
  EE bb 768   EE bb 768   FF aa 670   FF aa 670   FF aa 670   FF aa 670
  FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938   FF bb 938
  GG aa 634   GG aa 634   GG aa 634   GG aa 634   GG bb 938   GG bb 938
  GG bb 938   GG bb 938   HH aa 979   HH aa 979   HH aa 979   HH bb 963
  HH bb 963   HH bb 963   HH bb 963   HH bb 963   HH bb 963   II aa 652
  II aa 652   II bb 805   II bb 805   II bb 805   II bb 805   II bb 805
  JJ aa 899   JJ aa 899   JJ aa 899   JJ aa 899   JJ bb 839   JJ bb 839
  JJ bb 839   JJ bb 839}

do_execsql_test 1.16.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 223   AA aa 223   AA aa 223   AA aa 223   AA bb 309   AA bb 309
  AA bb 309   AA bb 309   BB aa 247   BB aa 247   BB aa 247   BB aa 247
  BB aa 247   BB aa 247   BB bb 633   BB bb 633   BB bb 633   BB bb 633
  BB bb 633   BB bb 633   CC aa 158   CC aa 158   CC aa 158   CC aa 158
  CC bb 346   CC bb 346   DD aa 224   DD aa 224   DD aa 224   DD bb 238
  DD bb 238   DD bb 238   DD bb 238   EE aa 113   EE aa 113   EE bb 252
  EE bb 252   EE bb 252   FF aa 208   FF aa 208   FF aa 208   FF aa 208
  FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102   FF bb 102
  GG aa 148   GG aa 148   GG aa 148   GG aa 148   GG bb 160   GG bb 160
  GG bb 160   GG bb 160   HH aa 480   HH aa 480   HH aa 480   HH bb 133
  HH bb 133   HH bb 133   HH bb 133   HH bb 133   HH bb 133   II aa 398
  II aa 398   II bb 250   II bb 250   II bb 250   II bb 250   II bb 250
  JJ aa 113   JJ aa 113   JJ aa 113   JJ aa 113   JJ bb 257   JJ bb 257
  JJ bb 257   JJ bb 257}

do_execsql_test 1.16.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 3751   AA aa 3774   AA aa 4446   AA aa 4462   AA bb 3815   AA bb 4058
  AA bb 4113   AA bb 4376   BB aa 6578   BB aa 6680   BB aa 6928   BB aa 6941
  BB aa 6947   BB aa 7093   BB bb 6500   BB bb 6548   BB bb 6554   BB bb 6629
  BB bb 6635   BB bb 6707   CC aa 2363   CC aa 2515   CC aa 2692   CC aa 2964
  CC bb 2300   CC bb 2776   DD aa 3187   DD aa 3776   DD aa 3808   DD bb 3073
  DD bb 3238   DD bb 3316   DD bb 3794   EE aa 1762   EE aa 2426   EE bb 1771
  EE bb 1910   EE bb 2287   FF aa 4998   FF aa 5001   FF aa 5050   FF aa 5460
  FF bb 4730   FF bb 4798   FF bb 4942   FF bb 5094   FF bb 5373   FF bb 5566
  GG aa 3834   GG aa 3988   GG aa 4133   GG aa 4320   GG bb 3530   GG bb 3539
  GG bb 3624   GG bb 4308   HH aa 4464   HH aa 4653   HH aa 4963   HH bb 4480
  HH bb 4713   HH bb 4760   HH bb 5088   HH bb 5113   HH bb 5310   II aa 2988
  II aa 3242   II bb 2835   II bb 2969   II bb 3197   II bb 3219   II bb 3390
  JJ aa 2901   JJ aa 3032   JJ aa 3566   JJ aa 3687   JJ bb 2961   JJ bb 3446
  JJ bb 3464   JJ bb 3543}

do_execsql_test 1.16.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 0 FOLLOWING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1373   AA aa 1396   AA aa 2068   AA aa 2084   AA bb 1508   AA bb 1751
  AA bb 1806   AA bb 2069   BB aa 2111   BB aa 2213   BB aa 2461   BB aa 2474
  BB aa 2480   BB aa 2626   BB bb 3627   BB bb 3675   BB bb 3681   BB bb 3756
  BB bb 3762   BB bb 3834   CC aa 1195   CC aa 1347   CC aa 1524   CC aa 1796
  CC bb 346   CC bb 822   DD aa 480   DD aa 1069   DD aa 1101   DD bb 1748
  DD bb 1913   DD bb 1991   DD bb 2469   EE aa 113   EE aa 777   EE bb 881
  EE bb 1020   EE bb 1397   FF aa 1493   FF aa 1496   FF aa 1545   FF aa 1955
  FF bb 2567   FF bb 2635   FF bb 2779   FF bb 2931   FF bb 3210   FF bb 3403
  GG aa 963   GG aa 1117   GG aa 1262   GG aa 1449   GG bb 1933   GG bb 1942
  GG bb 2027   GG bb 2711   HH aa 1270   HH aa 1459   HH aa 1769   HH bb 2231
  HH bb 2464   HH bb 2511   HH bb 2839   HH bb 2864   HH bb 3061   II aa 398
  II aa 652   II bb 1785   II bb 1919   II bb 2147   II bb 2169   II bb 2340
  JJ aa 1115   JJ aa 1246   JJ aa 1780   JJ aa 1901   JJ bb 947   JJ bb 1432
  JJ bb 1450   JJ bb 1529}

do_execsql_test 1.17.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.17.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.17.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.17.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.17.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.17.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.17.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 0 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa {}   AA aa {}   AA aa {}   AA aa {}   AA bb {}   AA bb {}   AA bb {}
  AA bb {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}   BB aa {}
  BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   BB bb {}   CC aa {}
  CC aa {}   CC aa {}   CC aa {}   CC bb {}   CC bb {}   DD aa {}   DD aa {}
  DD aa {}   DD bb {}   DD bb {}   DD bb {}   DD bb {}   EE aa {}   EE aa {}
  EE bb {}   EE bb {}   EE bb {}   FF aa {}   FF aa {}   FF aa {}   FF aa {}
  FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   FF bb {}   GG aa {}
  GG aa {}   GG aa {}   GG aa {}   GG bb {}   GG bb {}   GG bb {}   GG bb {}
  HH aa {}   HH aa {}   HH aa {}   HH bb {}   HH bb {}   HH bb {}   HH bb {}
  HH bb {}   HH bb {}   II aa {}   II aa {}   II bb {}   II bb {}   II bb {}
  II bb {}   II bb {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}
  JJ bb {}   JJ bb {}   JJ bb {}}

do_execsql_test 1.18.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 22701   AA aa 22701   AA aa 22701   AA aa 22701   AA bb 22701
  AA bb 22701   AA bb 22701   AA bb 22701   BB aa 19829   BB aa 19829
  BB aa 19829   BB aa 19829   BB aa 19829   BB aa 19829   BB bb 19829
  BB bb 19829   BB bb 19829   BB bb 19829   BB bb 19829   BB bb 19829
  CC aa 22150   CC aa 22150   CC aa 22150   CC aa 22150   CC bb 22150
  CC bb 22150   DD aa 21758   DD aa 21758   DD aa 21758   DD bb 21758
  DD bb 21758   DD bb 21758   DD bb 21758   EE aa 23019   EE aa 23019
  EE bb 23019   EE bb 23019   EE bb 23019   FF aa 17351   FF aa 17351
  FF aa 17351   FF aa 17351   FF bb 17351   FF bb 17351   FF bb 17351
  FF bb 17351   FF bb 17351   FF bb 17351   GG aa 12883   GG aa 12883
  GG aa 12883   GG aa 12883   GG bb 12883   GG bb 12883   GG bb 12883
  GG bb 12883   HH aa 7440   HH aa 7440   HH aa 7440   HH bb 7440
  HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 3800
  II aa 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800
  JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}
  JJ bb {}}

do_execsql_test 1.18.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 12840   AA aa 12840   AA aa 12840   AA aa 12840   AA bb 11787
  AA bb 11787   AA bb 11787   AA bb 11787   BB aa 11621   BB aa 11621
  BB aa 11621   BB aa 11621   BB aa 11621   BB aa 11621   BB bb 8044
  BB bb 8044   BB bb 8044   BB bb 8044   BB bb 8044   BB bb 8044   CC aa 7739
  CC aa 7739   CC aa 7739   CC aa 7739   CC bb 8734   CC bb 8734
  DD aa 10914   DD aa 10914   DD aa 10914   DD bb 9804   DD bb 9804
  DD bb 9804   DD bb 9804   EE aa 11785   EE aa 11785   EE bb 12385
  EE bb 12385   EE bb 12385   FF aa 13416   FF aa 13416   FF aa 13416
  FF aa 13416   FF bb 10961   FF bb 10961   FF bb 10961   FF bb 10961
  FF bb 10961   FF bb 10961   GG aa 11954   GG aa 11954   GG aa 11954
  GG aa 11954   GG bb 11097   GG bb 11097   GG bb 11097   GG bb 11097
  HH aa 10634   HH aa 10634   HH aa 10634   HH bb 7440   HH bb 7440
  HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 6390   II aa 6390
  II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   JJ aa 1786
  JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ bb {}   JJ bb {}   JJ bb {}
  JJ bb {}}

do_execsql_test 1.18.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.18.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 870   AA aa 870   AA aa 870   AA aa 870   AA bb 845   AA bb 845
  AA bb 845   AA bb 845   BB aa 959   BB aa 959   BB aa 959   BB aa 959
  BB aa 959   BB aa 959   BB bb 959   BB bb 959   BB bb 959   BB bb 959
  BB bb 959   BB bb 959   CC aa 959   CC aa 959   CC aa 959   CC aa 959
  CC bb 959   CC bb 959   DD aa 959   DD aa 959   DD aa 959   DD bb 938
  DD bb 938   DD bb 938   DD bb 938   EE aa 938   EE aa 938   EE bb 979
  EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979
  FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979
  GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979
  GG bb 979   GG bb 979   HH aa 963   HH aa 963   HH aa 963   HH bb 899
  HH bb 899   HH bb 899   HH bb 899   HH bb 899   HH bb 899   II aa 899
  II aa 899   II bb 899   II bb 899   II bb 899   II bb 899   II bb 899
  JJ aa 839   JJ aa 839   JJ aa 839   JJ aa 839   JJ bb {}   JJ bb {}
  JJ bb {}   JJ bb {}}

do_execsql_test 1.18.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 158   AA aa 158   AA aa 158   AA aa 158   AA bb 158   AA bb 158
  AA bb 158   AA bb 158   BB aa 158   BB aa 158   BB aa 158   BB aa 158
  BB aa 158   BB aa 158   BB bb 113   BB bb 113   BB bb 113   BB bb 113
  BB bb 113   BB bb 113   CC aa 113   CC aa 113   CC aa 113   CC aa 113
  CC bb 113   CC bb 113   DD aa 102   DD aa 102   DD aa 102   DD bb 102
  DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102
  EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102
  FF bb 133   FF bb 133   FF bb 133   FF bb 133   FF bb 133   FF bb 133
  GG aa 133   GG aa 133   GG aa 133   GG aa 133   GG bb 113   GG bb 113
  GG bb 113   GG bb 113   HH aa 113   HH aa 113   HH aa 113   HH bb 113
  HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   II aa 113
  II aa 113   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113
  JJ aa 257   JJ aa 257   JJ aa 257   JJ aa 257   JJ bb {}   JJ bb {}
  JJ bb {}   JJ bb {}}

do_execsql_test 1.18.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 22701   AA aa 22701   AA aa 22701   AA aa 22701   AA bb 22701
  AA bb 22701   AA bb 22701   AA bb 22701   BB aa 19829   BB aa 19829
  BB aa 19829   BB aa 19829   BB aa 19829   BB aa 19829   BB bb 19829
  BB bb 19829   BB bb 19829   BB bb 19829   BB bb 19829   BB bb 19829
  CC aa 22150   CC aa 22150   CC aa 22150   CC aa 22150   CC bb 22150
  CC bb 22150   DD aa 21758   DD aa 21758   DD aa 21758   DD bb 21758
  DD bb 21758   DD bb 21758   DD bb 21758   EE aa 23019   EE aa 23019
  EE bb 23019   EE bb 23019   EE bb 23019   FF aa 17351   FF aa 17351
  FF aa 17351   FF aa 17351   FF bb 17351   FF bb 17351   FF bb 17351
  FF bb 17351   FF bb 17351   FF bb 17351   GG aa 12883   GG aa 12883
  GG aa 12883   GG aa 12883   GG bb 12883   GG bb 12883   GG bb 12883
  GG bb 12883   HH aa 7440   HH aa 7440   HH aa 7440   HH bb 7440
  HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 3800
  II aa 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800
  JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}
  JJ bb {}}

do_execsql_test 1.18.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND 5 FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 12840   AA aa 12840   AA aa 12840   AA aa 12840   AA bb 11787
  AA bb 11787   AA bb 11787   AA bb 11787   BB aa 11621   BB aa 11621
  BB aa 11621   BB aa 11621   BB aa 11621   BB aa 11621   BB bb 8044
  BB bb 8044   BB bb 8044   BB bb 8044   BB bb 8044   BB bb 8044   CC aa 7739
  CC aa 7739   CC aa 7739   CC aa 7739   CC bb 8734   CC bb 8734
  DD aa 10914   DD aa 10914   DD aa 10914   DD bb 9804   DD bb 9804
  DD bb 9804   DD bb 9804   EE aa 11785   EE aa 11785   EE bb 12385
  EE bb 12385   EE bb 12385   FF aa 13416   FF aa 13416   FF aa 13416
  FF aa 13416   FF bb 10961   FF bb 10961   FF bb 10961   FF bb 10961
  FF bb 10961   FF bb 10961   GG aa 11954   GG aa 11954   GG aa 11954
  GG aa 11954   GG bb 11097   GG bb 11097   GG bb 11097   GG bb 11097
  HH aa 10634   HH aa 10634   HH aa 10634   HH bb 7440   HH bb 7440
  HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 6390   II aa 6390
  II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   JJ aa 1786
  JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ bb {}   JJ bb {}   JJ bb {}
  JJ bb {}}

do_execsql_test 1.19.1 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 40052   AA aa 40052   AA aa 40052   AA aa 40052   AA bb 40052
  AA bb 40052   AA bb 40052   AA bb 40052   BB aa 32712   BB aa 32712
  BB aa 32712   BB aa 32712   BB aa 32712   BB aa 32712   BB bb 32712
  BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712
  CC aa 29590   CC aa 29590   CC aa 29590   CC aa 29590   CC bb 29590
  CC bb 29590   DD aa 25558   DD aa 25558   DD aa 25558   DD bb 25558
  DD bb 25558   DD bb 25558   DD bb 25558   EE aa 23019   EE aa 23019
  EE bb 23019   EE bb 23019   EE bb 23019   FF aa 17351   FF aa 17351
  FF aa 17351   FF aa 17351   FF bb 17351   FF bb 17351   FF bb 17351
  FF bb 17351   FF bb 17351   FF bb 17351   GG aa 12883   GG aa 12883
  GG aa 12883   GG aa 12883   GG bb 12883   GG bb 12883   GG bb 12883
  GG bb 12883   HH aa 7440   HH aa 7440   HH aa 7440   HH bb 7440
  HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 3800
  II aa 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800
  JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}
  JJ bb {}}

do_execsql_test 1.19.2 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 42430   AA aa 42430   AA aa 42430   AA aa 42430   AA bb 40052
  AA bb 40052   AA bb 40052   AA bb 40052   BB aa 37179   BB aa 37179
  BB aa 37179   BB aa 37179   BB aa 37179   BB aa 37179   BB bb 32712
  BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712
  CC aa 30758   CC aa 30758   CC aa 30758   CC aa 30758   CC bb 29590
  CC bb 29590   DD aa 28265   DD aa 28265   DD aa 28265   DD bb 25558
  DD bb 25558   DD bb 25558   DD bb 25558   EE aa 24668   EE aa 24668
  EE bb 23019   EE bb 23019   EE bb 23019   FF aa 20856   FF aa 20856
  FF aa 20856   FF aa 20856   FF bb 17351   FF bb 17351   FF bb 17351
  FF bb 17351   FF bb 17351   FF bb 17351   GG aa 15754   GG aa 15754
  GG aa 15754   GG aa 15754   GG bb 12883   GG bb 12883   GG bb 12883
  GG bb 12883   HH aa 10634   HH aa 10634   HH aa 10634   HH bb 7440
  HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 6390
  II aa 6390   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800
  JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ bb {}   JJ bb {}
  JJ bb {}   JJ bb {}}

do_execsql_test 1.19.3 {
  SELECT a, b, rank() OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 1   AA aa 1   AA aa 1   AA aa 1   AA bb 1   AA bb 1   AA bb 1
  AA bb 1   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9   BB aa 9
  BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   BB bb 9   CC aa 21
  CC aa 21   CC aa 21   CC aa 21   CC bb 21   CC bb 21   DD aa 27   DD aa 27
  DD aa 27   DD bb 27   DD bb 27   DD bb 27   DD bb 27   EE aa 34   EE aa 34
  EE bb 34   EE bb 34   EE bb 34   FF aa 39   FF aa 39   FF aa 39   FF aa 39
  FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   FF bb 39   GG aa 49
  GG aa 49   GG aa 49   GG aa 49   GG bb 49   GG bb 49   GG bb 49   GG bb 49
  HH aa 57   HH aa 57   HH aa 57   HH bb 57   HH bb 57   HH bb 57   HH bb 57
  HH bb 57   HH bb 57   II aa 66   II aa 66   II bb 66   II bb 66   II bb 66
  II bb 66   II bb 66   JJ aa 73   JJ aa 73   JJ aa 73   JJ aa 73   JJ bb 73
  JJ bb 73   JJ bb 73   JJ bb 73}

do_execsql_test 1.19.4 {
  SELECT a, b, max(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 979   AA aa 979   AA aa 979   AA aa 979   AA bb 979   AA bb 979
  AA bb 979   AA bb 979   BB aa 979   BB aa 979   BB aa 979   BB aa 979
  BB aa 979   BB aa 979   BB bb 979   BB bb 979   BB bb 979   BB bb 979
  BB bb 979   BB bb 979   CC aa 979   CC aa 979   CC aa 979   CC aa 979
  CC bb 979   CC bb 979   DD aa 979   DD aa 979   DD aa 979   DD bb 979
  DD bb 979   DD bb 979   DD bb 979   EE aa 979   EE aa 979   EE bb 979
  EE bb 979   EE bb 979   FF aa 979   FF aa 979   FF aa 979   FF aa 979
  FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979   FF bb 979
  GG aa 979   GG aa 979   GG aa 979   GG aa 979   GG bb 979   GG bb 979
  GG bb 979   GG bb 979   HH aa 963   HH aa 963   HH aa 963   HH bb 899
  HH bb 899   HH bb 899   HH bb 899   HH bb 899   HH bb 899   II aa 899
  II aa 899   II bb 899   II bb 899   II bb 899   II bb 899   II bb 899
  JJ aa 839   JJ aa 839   JJ aa 839   JJ aa 839   JJ bb {}   JJ bb {}
  JJ bb {}   JJ bb {}}

do_execsql_test 1.19.5 {
  SELECT a, b, min(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING ) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 102   AA aa 102   AA aa 102   AA aa 102   AA bb 102   AA bb 102
  AA bb 102   AA bb 102   BB aa 102   BB aa 102   BB aa 102   BB aa 102
  BB aa 102   BB aa 102   BB bb 102   BB bb 102   BB bb 102   BB bb 102
  BB bb 102   BB bb 102   CC aa 102   CC aa 102   CC aa 102   CC aa 102
  CC bb 102   CC bb 102   DD aa 102   DD aa 102   DD aa 102   DD bb 102
  DD bb 102   DD bb 102   DD bb 102   EE aa 102   EE aa 102   EE bb 102
  EE bb 102   EE bb 102   FF aa 102   FF aa 102   FF aa 102   FF aa 102
  FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113   FF bb 113
  GG aa 113   GG aa 113   GG aa 113   GG aa 113   GG bb 113   GG bb 113
  GG bb 113   GG bb 113   HH aa 113   HH aa 113   HH aa 113   HH bb 113
  HH bb 113   HH bb 113   HH bb 113   HH bb 113   HH bb 113   II aa 113
  II aa 113   II bb 113   II bb 113   II bb 113   II bb 113   II bb 113
  JJ aa 257   JJ aa 257   JJ aa 257   JJ aa 257   JJ bb {}   JJ bb {}
  JJ bb {}   JJ bb {}}

do_execsql_test 1.19.6 {
  SELECT a, b, sum(c) OVER (ORDER BY a  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 40052   AA aa 40052   AA aa 40052   AA aa 40052   AA bb 40052
  AA bb 40052   AA bb 40052   AA bb 40052   BB aa 32712   BB aa 32712
  BB aa 32712   BB aa 32712   BB aa 32712   BB aa 32712   BB bb 32712
  BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712
  CC aa 29590   CC aa 29590   CC aa 29590   CC aa 29590   CC bb 29590
  CC bb 29590   DD aa 25558   DD aa 25558   DD aa 25558   DD bb 25558
  DD bb 25558   DD bb 25558   DD bb 25558   EE aa 23019   EE aa 23019
  EE bb 23019   EE bb 23019   EE bb 23019   FF aa 17351   FF aa 17351
  FF aa 17351   FF aa 17351   FF bb 17351   FF bb 17351   FF bb 17351
  FF bb 17351   FF bb 17351   FF bb 17351   GG aa 12883   GG aa 12883
  GG aa 12883   GG aa 12883   GG bb 12883   GG bb 12883   GG bb 12883
  GG bb 12883   HH aa 7440   HH aa 7440   HH aa 7440   HH bb 7440
  HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 3800
  II aa 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800
  JJ aa {}   JJ aa {}   JJ aa {}   JJ aa {}   JJ bb {}   JJ bb {}   JJ bb {}
  JJ bb {}}

do_execsql_test 1.19.7 {
  SELECT a, b, sum(c) OVER (ORDER BY a,b  GROUPS BETWEEN 1 FOLLOWING         AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW) FROM t3 ORDER BY 1, 2, 3;
} {AA aa 42430   AA aa 42430   AA aa 42430   AA aa 42430   AA bb 40052
  AA bb 40052   AA bb 40052   AA bb 40052   BB aa 37179   BB aa 37179
  BB aa 37179   BB aa 37179   BB aa 37179   BB aa 37179   BB bb 32712
  BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712   BB bb 32712
  CC aa 30758   CC aa 30758   CC aa 30758   CC aa 30758   CC bb 29590
  CC bb 29590   DD aa 28265   DD aa 28265   DD aa 28265   DD bb 25558
  DD bb 25558   DD bb 25558   DD bb 25558   EE aa 24668   EE aa 24668
  EE bb 23019   EE bb 23019   EE bb 23019   FF aa 20856   FF aa 20856
  FF aa 20856   FF aa 20856   FF bb 17351   FF bb 17351   FF bb 17351
  FF bb 17351   FF bb 17351   FF bb 17351   GG aa 15754   GG aa 15754
  GG aa 15754   GG aa 15754   GG bb 12883   GG bb 12883   GG bb 12883
  GG bb 12883   HH aa 10634   HH aa 10634   HH aa 10634   HH bb 7440
  HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   HH bb 7440   II aa 6390
  II aa 6390   II bb 3800   II bb 3800   II bb 3800   II bb 3800   II bb 3800
  JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ aa 1786   JJ bb {}   JJ bb {}
  JJ bb {}   JJ bb {}}

do_execsql_test 2.1.1 {
  SELECT row_number() OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE NO OTHERS 
    )
} {1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17
  18   19   20   21   22   23   24   25   26   27   28   29   30   31   32
  33   34   35   36   37   38   39   40   41   42   43   44   45   46   47
  48   49   50   51   52   53   54   55   56   57   58   59   60   61   62
  63   64   65   66   67   68   69   70   71   72   73   74   75   76   77
  78   79   80}

do_execsql_test 2.1.2 {
  SELECT nth_value(c, 14) OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE NO OTHERS 
    )
} {247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247}

do_execsql_test 2.1.3 {
  SELECT min(c) OVER win, max(c) OVER win, sum(c) OVER win FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW  EXCLUDE NO OTHERS 
    ) ORDER BY a, b, c;
} {102 223 1358   102 239 2293   102 911 38097   102 934 39960   102 309 4159
  102 572 10643   102 627 13069   102 870 35417   102 247 2540   102 393 6608
  102 399 7405   102 412 7817   102 660 16277   102 762 24077   102 633 14331
  102 705 19673   102 711 20384   102 786 27176   102 792 28758
  102 840 32858   102 158 767   102 430 8668   102 607 11824   102 759 23315
  102 346 5506   102 822 31179   102 224 1582   102 256 3298   102 845 34547
  102 238 2054   102 716 21100   102 794 29552   102 959 42795   102 113 215
  102 777 26390   102 252 3042   102 629 13698   102 768 25613   102 208 1135
  102 618 12442   102 667 16944   102 670 17614   102 102 102   102 295 3850
  102 574 11217   102 726 21826   102 870 36287   102 938 40898   102 148 609
  102 335 4824   102 480 9591   102 634 14965   102 160 927   102 844 33702
  102 929 39026   102 938 41836   102 480 10071   102 790 27966
  102 979 44737   102 133 461   102 330 4489   102 355 6215   102 683 18968
  102 730 22556   102 963 43758   102 398 7006   102 652 15617   102 250 2790
  102 421 8238   102 443 9111   102 671 18285   102 805 30357   102 113 328
  102 234 1816   102 768 24845   102 899 37186   102 257 3555   102 336 5160
  102 354 5860   102 839 32018}

do_execsql_test 2.2.1 {
  SELECT row_number() OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW 
    )
} {1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17
  18   19   20   21   22   23   24   25   26   27   28   29   30   31   32
  33   34   35   36   37   38   39   40   41   42   43   44   45   46   47
  48   49   50   51   52   53   54   55   56   57   58   59   60   61   62
  63   64   65   66   67   68   69   70   71   72   73   74   75   76   77
  78   79   80}

do_execsql_test 2.2.2 {
  SELECT nth_value(c, 14) OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE CURRENT ROW 
    )
} {250   250   250   250   250   250   250   250   250   250   250   250   250
  250   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247}

do_execsql_test 2.2.3 {
  SELECT min(c) OVER win, max(c) OVER win, sum(c) OVER win FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW  EXCLUDE CURRENT ROW 
    ) ORDER BY a, b, c;
} {102 208 1135   102 238 2054   102 899 37186   102 929 39026   102 295 3850
  102 480 10071   102 618 12442   102 845 34547   102 239 2293   102 355 6215
  102 398 7006   102 399 7405   102 652 15617   102 759 23315   102 629 13698
  102 683 18968   102 705 19673   102 777 26390   102 790 27966
  102 839 32018   102 148 609   102 421 8238   102 574 11217   102 730 22556
  102 336 5160   102 805 30357   102 223 1358   102 252 3042   102 844 33702
  102 234 1816   102 711 20384   102 792 28758   102 938 41836   102 102 102
  102 768 25613   102 250 2790   102 627 13069   102 768 24845   102 160 927
  102 607 11824   102 660 16277   102 667 16944   {} {} {}   102 257 3555
  102 572 10643   102 716 21100   102 870 35417   102 934 39960   102 133 461
  102 330 4489   102 443 9111   102 633 14331   102 158 767   102 840 32858
  102 911 38097   102 938 40898   102 480 9591   102 786 27176
  102 963 43758   102 113 328   102 309 4159   102 354 5860   102 671 18285
  102 726 21826   102 959 42795   102 393 6608   102 634 14965   102 247 2540
  102 412 7817   102 430 8668   102 670 17614   102 794 29552   102 113 215
  102 224 1582   102 762 24077   102 870 36287   102 256 3298   102 335 4824
  102 346 5506   102 822 31179}

do_execsql_test 2.3.1 {
  SELECT row_number() OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE GROUP 
    )
} {1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17
  18   19   20   21   22   23   24   25   26   27   28   29   30   31   32
  33   34   35   36   37   38   39   40   41   42   43   44   45   46   47
  48   49   50   51   52   53   54   55   56   57   58   59   60   61   62
  63   64   65   66   67   68   69   70   71   72   73   74   75   76   77
  78   79   80}

do_execsql_test 2.3.2 {
  SELECT nth_value(c, 14) OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE GROUP 
    )
} {250   250   250   250   250   250   250   250   250   250   250   250   250
  250   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247}

do_execsql_test 2.3.3 {
  SELECT min(c) OVER win, max(c) OVER win, sum(c) OVER win FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW  EXCLUDE GROUP 
    ) ORDER BY a, b, c;
} {102 208 1135   102 238 2054   102 899 37186   102 929 39026   102 295 3850
  102 480 10071   102 618 12442   102 845 34547   102 239 2293   102 355 6215
  102 398 7006   102 399 7405   102 652 15617   102 759 23315   102 629 13698
  102 683 18968   102 705 19673   102 777 26390   102 790 27966
  102 839 32018   102 148 609   102 421 8238   102 574 11217   102 730 22556
  102 336 5160   102 805 30357   102 223 1358   102 252 3042   102 844 33702
  102 234 1816   102 711 20384   102 792 28758   102 938 41836   102 102 102
  102 768 25613   102 250 2790   102 627 13069   102 768 24845   102 160 927
  102 607 11824   102 660 16277   102 667 16944   {} {} {}   102 257 3555
  102 572 10643   102 716 21100   102 870 35417   102 934 39960   102 133 461
  102 330 4489   102 443 9111   102 633 14331   102 158 767   102 840 32858
  102 911 38097   102 938 40898   102 480 9591   102 786 27176
  102 963 43758   102 113 328   102 309 4159   102 354 5860   102 671 18285
  102 726 21826   102 959 42795   102 393 6608   102 634 14965   102 247 2540
  102 412 7817   102 430 8668   102 670 17614   102 794 29552   102 113 215
  102 224 1582   102 762 24077   102 870 36287   102 256 3298   102 335 4824
  102 346 5506   102 822 31179}

do_execsql_test 2.4.1 {
  SELECT row_number() OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE TIES 
    )
} {1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17
  18   19   20   21   22   23   24   25   26   27   28   29   30   31   32
  33   34   35   36   37   38   39   40   41   42   43   44   45   46   47
  48   49   50   51   52   53   54   55   56   57   58   59   60   61   62
  63   64   65   66   67   68   69   70   71   72   73   74   75   76   77
  78   79   80}

do_execsql_test 2.4.2 {
  SELECT nth_value(c, 14) OVER win 
    FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING  EXCLUDE TIES 
    )
} {247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247   247   247   247   247   247   247   247   247   247   247   247
  247   247}

do_execsql_test 2.4.3 {
  SELECT min(c) OVER win, max(c) OVER win, sum(c) OVER win FROM t3
    WINDOW win AS (
      ORDER BY c, b, a
      ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW  EXCLUDE TIES 
    ) ORDER BY a, b, c;
} {102 223 1358   102 239 2293   102 911 38097   102 934 39960   102 309 4159
  102 572 10643   102 627 13069   102 870 35417   102 247 2540   102 393 6608
  102 399 7405   102 412 7817   102 660 16277   102 762 24077   102 633 14331
  102 705 19673   102 711 20384   102 786 27176   102 792 28758
  102 840 32858   102 158 767   102 430 8668   102 607 11824   102 759 23315
  102 346 5506   102 822 31179   102 224 1582   102 256 3298   102 845 34547
  102 238 2054   102 716 21100   102 794 29552   102 959 42795   102 113 215
  102 777 26390   102 252 3042   102 629 13698   102 768 25613   102 208 1135
  102 618 12442   102 667 16944   102 670 17614   102 102 102   102 295 3850
  102 574 11217   102 726 21826   102 870 36287   102 938 40898   102 148 609
  102 335 4824   102 480 9591   102 634 14965   102 160 927   102 844 33702
  102 929 39026   102 938 41836   102 480 10071   102 790 27966
  102 979 44737   102 133 461   102 330 4489   102 355 6215   102 683 18968
  102 730 22556   102 963 43758   102 398 7006   102 652 15617   102 250 2790
  102 421 8238   102 443 9111   102 671 18285   102 805 30357   102 113 328
  102 234 1816   102 768 24845   102 899 37186   102 257 3555   102 336 5160
  102 354 5860   102 839 32018}

#==========================================================================

do_execsql_test 3.0 {
  DROP TABLE IF EXISTS t1;
  CREATE TABLE t1(a REAL, b INTEGER);
  INSERT INTO t1 VALUES
................................................................................
do_execsql_test 3.11 {
  SELECT CAST(a AS INTEGER), sum(b) OVER win FROM t1 WINDOW win AS ( ORDER BY a DESC RANGE BETWEEN UNBOUNDED PRECEDING AND 5.9 PRECEDING )
} {30 {}   22 90   20 90   15 170   13 210   13 210   10 210   5 292}

do_execsql_test 3.12 {
  SELECT CAST(a AS INTEGER), sum(b) OVER win FROM t1 WINDOW win AS ( ORDER BY a DESC RANGE BETWEEN 2.1 FOLLOWING AND UNBOUNDED FOLLOWING )
} {30 232   22 112   20 112   15 30   13 30   13 30   10 10   5 {}}

#==========================================================================

do_execsql_test 4.0 {
  DROP TABLE IF EXISTS t1;
  CREATE TABLE t1(a INTEGER, b INTEGER);
  INSERT INTO t1 VALUES
    (NULL, 1), (NULL, 2), (NULL, 3), (10, 4), (10, 5);
} {}

do_execsql_test 4.1 {
  SELECT sum(b) OVER (
    ORDER BY a RANGE BETWEEN 5 PRECEDING AND 10 FOLLOWING
  ) FROM t1 ORDER BY 1;
} {6   6   6   9   9}

finish_test