# 2019 March 01
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#

####################################################
# DO NOT EDIT! THIS FILE IS AUTOMATICALLY GENERATED!
####################################################

set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix window8

ifcapable !windowfunc { finish_test ; return }
do_execsql_test 1.0 {
  DROP TABLE IF EXISTS t3;
  CREATE TABLE t3(a TEXT, b TEXT, c INTEGER);
  INSERT INTO t3 VALUES
    ('HH', 'bb', 355), ('CC', 'aa', 158), ('BB', 'aa', 399), 
    ('FF', 'bb', 938), ('HH', 'aa', 480), ('FF', 'bb', 870), 
    ('JJ', 'aa', 768), ('JJ', 'aa', 899), ('GG', 'bb', 929), 
    ('II', 'bb', 421), ('GG', 'bb', 844), ('FF', 'bb', 574), 
    ('CC', 'bb', 822), ('GG', 'bb', 938), ('BB', 'aa', 660), 
    ('HH', 'aa', 979), ('BB', 'bb', 792), ('DD', 'aa', 845), 
    ('JJ', 'bb', 354), ('FF', 'bb', 295), ('JJ', 'aa', 234), 
    ('BB', 'bb', 840), ('AA', 'aa', 934), ('EE', 'aa', 113), 
    ('AA', 'bb', 309), ('BB', 'aa', 412), ('AA', 'aa', 911), 
    ('AA', 'bb', 572), ('II', 'aa', 398), ('II', 'bb', 250), 
    ('II', 'aa', 652), ('BB', 'bb', 633), ('AA', 'aa', 239), 
    ('FF', 'aa', 670), ('BB', 'bb', 705), ('HH', 'bb', 963), 
    ('CC', 'bb', 346), ('II', 'bb', 671), ('BB', 'aa', 247), 
    ('AA', 'aa', 223), ('GG', 'aa', 480), ('HH', 'aa', 790), 
    ('FF', 'aa', 208), ('BB', 'bb', 711), ('EE', 'aa', 777), 
    ('DD', 'bb', 716), ('CC', 'aa', 759), ('CC', 'aa', 430), 
    ('CC', 'aa', 607), ('DD', 'bb', 794), ('GG', 'aa', 148), 
    ('GG', 'aa', 634), ('JJ', 'bb', 257), ('DD', 'bb', 959), 
    ('FF', 'bb', 726), ('BB', 'aa', 762), ('JJ', 'bb', 336), 
    ('GG', 'aa', 335), ('HH', 'bb', 330), ('GG', 'bb', 160), 
    ('JJ', 'bb', 839), ('FF', 'aa', 618), ('BB', 'aa', 393), 
    ('EE', 'bb', 629), ('FF', 'aa', 667), ('AA', 'bb', 870), 
    ('FF', 'bb', 102), ('JJ', 'aa', 113), ('DD', 'aa', 224), 
    ('AA', 'bb', 627), ('HH', 'bb', 730), ('II', 'bb', 443), 
    ('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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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 2.0 {
  DROP TABLE IF EXISTS t1;
  CREATE TABLE t1(a INTEGER, b INTEGER);
  INSERT INTO t1 VALUES
      (13, 26), (15, 30);
} {}

do_execsql_test 2.1 {
  SELECT a, sum(b) OVER win FROM t1 WINDOW win AS ( ORDER BY a RANGE BETWEEN 5 PRECEDING AND 5 FOLLOWING )
} {13 56   15 56}

do_execsql_test 2.2 {
  SELECT a, sum(b) OVER win FROM t1 WINDOW win AS ( ORDER BY a RANGE BETWEEN 10 PRECEDING AND 5 PRECEDING )
} {13 {}   15 {}}

do_execsql_test 2.3 {
  SELECT a, sum(b) OVER win FROM t1 WINDOW win AS ( ORDER BY a RANGE BETWEEN 2 FOLLOWING AND 3 FOLLOWING )
} {13 30   15 {}}

finish_test
