/ Check-in [060b2640]
Login

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

Overview
Comment:Add support for window function first_value().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | exp-window-functions
Files: files | file ages | folders
SHA3-256: 060b26402880daab085ad01f5f0dbde957c7a22cd219be5b8ec94fba883051a0
User & Date: dan 2018-06-07 17:45:22
Context
2018-06-07
20:08
Add window functions lag() and lead(). check-in: ef342070 user: dan tags: exp-window-functions
17:45
Add support for window function first_value(). check-in: 060b2640 user: dan tags: exp-window-functions
15:54
Fix problems with the nth_value() function. check-in: 63002b9a user: dan tags: exp-window-functions
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/window.c.

305
306
307
308
309
310
311















312
313
314
315
316
317
318
...
331
332
333
334
335
336
337

338
339
340
341
342
343
344
...
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
...
722
723
724
725
726
727
728
729


730
731
732
733
734
735
736
...
835
836
837
838
839
840
841
842


843
844
845
846


847



848
849
850
851
852
853
854
...
883
884
885
886
887
888
889
890


891
892
893
894
895
896
897
....
1568
1569
1570
1571
1572
1573
1574

1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
  sqlite3_context *pCtx, 
  int nArg,
  sqlite3_value **apArg
){
}
static void nth_valueValueFunc(sqlite3_context *pCtx){
}
















#define WINDOWFUNC(name,nArg,extra) {                                      \
  nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0,                      \
  name ## StepFunc, name ## ValueFunc, name ## ValueFunc,                  \
  name ## InverseFunc, #name                                               \
}

................................................................................
    WINDOWFUNC(dense_rank, 0, 0),
    WINDOWFUNC(rank, 0, 0),
    WINDOWFUNC(percent_rank, 0, SQLITE_FUNC_WINDOW_SIZE),
    WINDOWFUNC(cume_dist, 0, SQLITE_FUNC_WINDOW_SIZE),
    WINDOWFUNC(ntile, 1, SQLITE_FUNC_WINDOW_SIZE),
    WINDOWFUNCF(last_value, 1, 0),
    WINDOWFUNC(nth_value, 2, 0),

  };
  sqlite3InsertBuiltinFuncs(aWindowFuncs, ArraySize(aWindowFuncs));
}

void sqlite3WindowUpdate(Parse *pParse, Window *pWin, FuncDef *pFunc){
  if( pFunc->funcFlags & SQLITE_FUNC_WINDOW ){
    sqlite3 *db = pParse->db;
................................................................................
        assert( pKeyInfo->aSortOrder[0]==0 );
        pKeyInfo->aSortOrder[0] = 1;
      }
      sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pWin->csrApp, 2);
      sqlite3VdbeAppendP4(v, pKeyInfo, P4_KEYINFO);
      sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1);
    }
    else if( p->xSFunc==nth_valueStepFunc ){
      /* Allocate two registers at pWin->regApp. These will be used to
      ** store the start and end index of the current frame.  */
      assert( pMWin->iEphCsr );
      pWin->regApp = pParse->nMem+1;
      pWin->csrApp = pParse->nTab++;
      pParse->nMem += 2;
      sqlite3VdbeAddOp2(v, OP_OpenDup, pWin->csrApp, pMWin->iEphCsr);
................................................................................
        sqlite3VdbeAddOp2(v, OP_IdxInsert, pWin->csrApp, pWin->regApp+2);
      }else{
        sqlite3VdbeAddOp4Int(v, OP_SeekGE, pWin->csrApp, 0, regArg, 1);
        sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp);
        sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
      }
    }else if( pWin->regApp ){
      assert( pWin->pFunc->xSFunc==nth_valueStepFunc );


      assert( bInverse==0 || bInverse==1 );
      sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1-bInverse, 1);
    }else{
      if( pWin->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){
        CollSeq *pColl;
        pColl = sqlite3ExprCollSeq(pParse, pWin->pOwner->x.pList->a[0].pExpr);
        sqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ);
................................................................................
  int regGosub,
  int addrGosub
){
  Vdbe *v = sqlite3GetVdbe(pParse);
  Window *pWin;
  for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
    FuncDef *pFunc = pWin->pFunc;
    if( pFunc->xSFunc==nth_valueStepFunc ){


      int csr = pWin->csrApp;
      int lbl = sqlite3VdbeMakeLabel(v);
      int tmpReg = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult);


      sqlite3VdbeAddOp3(v, OP_Column, pWin->iEphCsr, pWin->iArgCol+1, tmpReg);



      sqlite3VdbeAddOp3(v, OP_Add, tmpReg, pWin->regApp, tmpReg);
      sqlite3VdbeAddOp3(v, OP_Gt, pWin->regApp+1, lbl, tmpReg);
      sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg);
      sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult);
      sqlite3VdbeResolveLabel(v, lbl);
      sqlite3ReleaseTempReg(pParse, tmpReg);
    }
................................................................................
  Vdbe *v = sqlite3GetVdbe(pParse);
  int regArg;
  int nArg = 0;
  Window *pWin;
  for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
    sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
    nArg = MAX(nArg, pWin->nArg);
    if( pWin->pFunc->xSFunc==nth_valueStepFunc ){


      sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp);
      sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1);
    }
  }
  regArg = pParse->nMem+1;
  pParse->nMem += nArg;
  return regArg;
................................................................................
    return;
  }

  for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
    FuncDef *pFunc = pWin->pFunc;
    if( (pFunc->funcFlags & SQLITE_FUNC_WINDOW_SIZE)
     || (pFunc->xSFunc==nth_valueStepFunc)

    ){
      windowCodeCacheStep(pParse, p, pWInfo, regGosub, addrGosub);
      return;
    }
  }

  *pbLoop = 1;
  windowCodeDefaultStep(pParse, p, pWInfo, regGosub, addrGosub);
}








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







 







>







 







|







 







|
>
>







 







|
>
>




>
>
|
>
>
>







 







|
>
>







 







>










305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
...
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
...
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
...
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
...
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
...
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
....
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
  sqlite3_context *pCtx, 
  int nArg,
  sqlite3_value **apArg
){
}
static void nth_valueValueFunc(sqlite3_context *pCtx){
}

static void first_valueStepFunc(
  sqlite3_context *pCtx, 
  int nArg,
  sqlite3_value **apArg
){
}
static void first_valueInverseFunc(
  sqlite3_context *pCtx, 
  int nArg,
  sqlite3_value **apArg
){
}
static void first_valueValueFunc(sqlite3_context *pCtx){
}

#define WINDOWFUNC(name,nArg,extra) {                                      \
  nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0,                      \
  name ## StepFunc, name ## ValueFunc, name ## ValueFunc,                  \
  name ## InverseFunc, #name                                               \
}

................................................................................
    WINDOWFUNC(dense_rank, 0, 0),
    WINDOWFUNC(rank, 0, 0),
    WINDOWFUNC(percent_rank, 0, SQLITE_FUNC_WINDOW_SIZE),
    WINDOWFUNC(cume_dist, 0, SQLITE_FUNC_WINDOW_SIZE),
    WINDOWFUNC(ntile, 1, SQLITE_FUNC_WINDOW_SIZE),
    WINDOWFUNCF(last_value, 1, 0),
    WINDOWFUNC(nth_value, 2, 0),
    WINDOWFUNC(first_value, 1, 0),
  };
  sqlite3InsertBuiltinFuncs(aWindowFuncs, ArraySize(aWindowFuncs));
}

void sqlite3WindowUpdate(Parse *pParse, Window *pWin, FuncDef *pFunc){
  if( pFunc->funcFlags & SQLITE_FUNC_WINDOW ){
    sqlite3 *db = pParse->db;
................................................................................
        assert( pKeyInfo->aSortOrder[0]==0 );
        pKeyInfo->aSortOrder[0] = 1;
      }
      sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pWin->csrApp, 2);
      sqlite3VdbeAppendP4(v, pKeyInfo, P4_KEYINFO);
      sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1);
    }
    else if( p->xSFunc==nth_valueStepFunc || p->xSFunc==first_valueStepFunc ){
      /* Allocate two registers at pWin->regApp. These will be used to
      ** store the start and end index of the current frame.  */
      assert( pMWin->iEphCsr );
      pWin->regApp = pParse->nMem+1;
      pWin->csrApp = pParse->nTab++;
      pParse->nMem += 2;
      sqlite3VdbeAddOp2(v, OP_OpenDup, pWin->csrApp, pMWin->iEphCsr);
................................................................................
        sqlite3VdbeAddOp2(v, OP_IdxInsert, pWin->csrApp, pWin->regApp+2);
      }else{
        sqlite3VdbeAddOp4Int(v, OP_SeekGE, pWin->csrApp, 0, regArg, 1);
        sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp);
        sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
      }
    }else if( pWin->regApp ){
      assert( pWin->pFunc->xSFunc==nth_valueStepFunc 
           || pWin->pFunc->xSFunc==first_valueStepFunc 
      );
      assert( bInverse==0 || bInverse==1 );
      sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1-bInverse, 1);
    }else{
      if( pWin->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){
        CollSeq *pColl;
        pColl = sqlite3ExprCollSeq(pParse, pWin->pOwner->x.pList->a[0].pExpr);
        sqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ);
................................................................................
  int regGosub,
  int addrGosub
){
  Vdbe *v = sqlite3GetVdbe(pParse);
  Window *pWin;
  for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
    FuncDef *pFunc = pWin->pFunc;
    if( pFunc->xSFunc==nth_valueStepFunc 
     || pFunc->xSFunc==first_valueStepFunc 
    ){
      int csr = pWin->csrApp;
      int lbl = sqlite3VdbeMakeLabel(v);
      int tmpReg = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult);

      if( pFunc->xSFunc==nth_valueStepFunc ){
        sqlite3VdbeAddOp3(v, OP_Column, pWin->iEphCsr, pWin->iArgCol+1, tmpReg);
      }else{
        sqlite3VdbeAddOp2(v, OP_Integer, 1, tmpReg);
      }
      sqlite3VdbeAddOp3(v, OP_Add, tmpReg, pWin->regApp, tmpReg);
      sqlite3VdbeAddOp3(v, OP_Gt, pWin->regApp+1, lbl, tmpReg);
      sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg);
      sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult);
      sqlite3VdbeResolveLabel(v, lbl);
      sqlite3ReleaseTempReg(pParse, tmpReg);
    }
................................................................................
  Vdbe *v = sqlite3GetVdbe(pParse);
  int regArg;
  int nArg = 0;
  Window *pWin;
  for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
    sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
    nArg = MAX(nArg, pWin->nArg);
    if( pWin->pFunc->xSFunc==nth_valueStepFunc
     || pWin->pFunc->xSFunc==first_valueStepFunc 
    ){
      sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp);
      sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1);
    }
  }
  regArg = pParse->nMem+1;
  pParse->nMem += nArg;
  return regArg;
................................................................................
    return;
  }

  for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
    FuncDef *pFunc = pWin->pFunc;
    if( (pFunc->funcFlags & SQLITE_FUNC_WINDOW_SIZE)
     || (pFunc->xSFunc==nth_valueStepFunc)
     || (pFunc->xSFunc==first_valueStepFunc)
    ){
      windowCodeCacheStep(pParse, p, pWInfo, regGosub, addrGosub);
      return;
    }
  }

  *pbLoop = 1;
  windowCodeDefaultStep(pParse, p, pWInfo, regGosub, addrGosub);
}

Changes to test/window3.tcl.

219
220
221
222
223
224
225



















226
227
228
229
  "
  execsql_test 1.$tn.10.5 "
    SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a $window ) FROM t2
  "
  execsql_test 1.$tn.10.6 "
    SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 $window) FROM t2
  "



















}

finish_test








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




219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
  "
  execsql_test 1.$tn.10.5 "
    SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a $window ) FROM t2
  "
  execsql_test 1.$tn.10.6 "
    SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 $window) FROM t2
  "

  execsql_test 1.$tn.11.1 "
    SELECT first_value(b) OVER (ORDER BY a $window) FROM t2
  "
  execsql_test 1.$tn.11.2 "
    SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a $window) FROM t2
  "
  execsql_test 1.$tn.11.3 "
    SELECT first_value(b) OVER ( ORDER BY b,a $window ) FROM t2
  "
  execsql_test 1.$tn.11.4 "
    SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a $window ) FROM t2
  "
  execsql_test 1.$tn.11.5 "
    SELECT first_value(b) OVER ( ORDER BY b%10,a $window ) FROM t2
  "
  execsql_test 1.$tn.11.6 "
    SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 $window) FROM t2
  "
}

finish_test

Changes to test/window3.test.

317
318
319
320
321
322
323
























324
325
326
327
328
329
330
...
581
582
583
584
585
586
587
























588
589
590
591
592
593
594
...
845
846
847
848
849
850
851
























852
853
854
855
856
857
858
....
1109
1110
1111
1112
1113
1114
1115
























1116
1117
1118
1119
1120
1121
1122
....
1373
1374
1375
1376
1377
1378
1379
























1380
1381
1382
1383
1384
1385
1386
....
1637
1638
1639
1640
1641
1642
1643
























1644
1645
1646
1647
1648
1649
1650
....
1901
1902
1903
1904
1905
1906
1907
























1908
1909
1910
1911
1912
1913
1914
....
2165
2166
2167
2168
2169
2170
2171
























2172
2173
2174
2175
2176
2177
2178
....
2429
2430
2431
2432
2433
2434
2435
























2436
2437
2438
2439
2440
2441
2442
....
2693
2694
2695
2696
2697
2698
2699
























2700
2701
2702
2703
2704
2705
2706
....
2957
2958
2959
2960
2961
2962
2963
























2964
2965
2966
2967
2968
2969
2970
....
3221
3222
3223
3224
3225
3226
3227
























3228
3229
3230
3231
3232
3233
3234
....
3485
3486
3487
3488
3489
3490
3491
























3492
3493
3494
3495
3496
3497
3498
....
3749
3750
3751
3752
3753
3754
3755
























3756
3757
3758
3759
3760
3761
3762
....
4013
4014
4015
4016
4017
4018
4019
























4020
4021
4022
4023
4024
4025
4026
....
4277
4278
4279
4280
4281
4282
4283
























4284
4285
4286
4287
4288
4289
4290
....
4541
4542
4543
4544
4545
4546
4547
























4548
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   90   1   30   {}   {}   {}   31   30   {}   {}   {}   1   40   {}   50   11   81   42   40   {}   50   81   40   {}   {}   50   {}   52   {}   41   81   {}   41   {}   2   30   2   81   82   53   {}   10   {}   {}   81   {}   41   10   81   30   81   {}   3   3   23   {}   3   61   80   {}   94   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.1.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.2.2.1 {
  SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.2.2.2 {
  SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   74   32   31   84   91   74   3   93   84   74   31   12   90   31   22   74   64   43   64   64   90   74   22   43   90   1   30   62   22   31   31   30   74   64   64   1   40   33   50   11   81   42   40   13   50   81   40   13   13   50   33   52   24   41   81   34   41   34   2   30   2   81   82   53   33   10   33   33   81   34   41   10   81   30   81   4   3   3   23   94   3   61   80   84   94   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.2.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.3.2.1 {
  SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}

do_execsql_test 1.3.2.2 {
  SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.3.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND CURRENT ROW) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.4.2.1 {
  SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83   82   82   17   7}

do_execsql_test 1.4.2.2 {
  SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   64   42   81   94   1   44   73   74   44   85   22   33   41   72   93   34   65   54   5   15   81   15   63   84   21   2   62   54   93   43   33   2   75   16   86   23   12   85   62   13   53   94   12   75   23   73   72   96   46   33   55   25   26   74   34   87   84   87   55   53   25   84   75   56   66   54   36   97   55   78   84   84   95   74   65   17   87   77   96   8   47   95   34   89   98   7   46   6   96   8   47   95   56   89   59   36   36   78   96   89   29   37   95   56   39   {}   8   58   67   85   86   {}   58   49   {}   29   76   {}   77   {}   78   56   98   36   97   {}   59   89   89   47   78   {}   {}   {}   38   68   58   {}   58   38   {}   98   {}   {}   {}   19   57   9   {}   9   {}   {}   7   {}   {}   {}   39   89   38   78   39   {}   {}   8   19   {}   {}   {}   {}   89   {}   39   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   9   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.4.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.5.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{}   {}   {}   {}   0   74   74   74   74   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.5.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{}   {}   {}   {}   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   90   1   30   {}   {}   {}   {}   30   {}   {}   {}   1   40   {}   50   11   81   {}   40   {}   50   81   40   {}   {}   50   {}   {}   {}   41   81   {}   41   {}   2   30   2   81   82   {}   {}   10   {}   {}   81   {}   41   10   81   30   81   {}   {}   3   23   {}   3   61   80   {}   {}   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.5.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.6.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
} {{}   {}   0   74   74   74   74   99   99   99   33   89   89   96   96   96   68   68   68   91   91   91   99   99   99   97   78   78   97   97   97   67   93   93   93   84   77   23   93   93   93   65   47   86   86   86   91   91   91   85   85   85   59   59   56   56   91   91   91   90   90   55   89   89   89   47   56   56   56   56   56   75   75   89   98   98   98   81   94   94   94   78   78   78   53   63   63   87   87   87   84   84   84   72   61   73   95   95   95   65   96   98   98   98   74   74   74   65   73   73   73   87   87   87   41   20   31   31   31   95   95   95   79   88   88   88   34   49   49   90   90   96   96   96   75   77   77   77   44   85   85   85   74   74   70   70   59   39   39   47   80   90   90   90   58   58   72   72   72   72   93   93   93   81   81   81   37   37   37   14   62   91   91   91   91   91   34   36   99   99   99   95   95   69   58   52   84   84   84   84   84   39   44   58   58   58   38   83   83   83}

do_execsql_test 1.6.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
} {{}   {}   0   0   0   41   23   23   23   26   2   2   2   81   59   38   38   38   39   39   46   6   6   6   27   27   27   46   54   8   8   8   29   29   77   23   16   16   16   16   35   35   7   7   7   61   61   61   24   24   24   43   12   12   12   3   3   3   22   22   15   15   15   25   25   1   1   1   40   40   16   16   16   36   36   76   76   4   4   4   30   30   30   29   29   29   2   2   2   37   37   72   41   9   9   9   61   65   13   13   13   58   1   1   1   21   35   5   5   5   11   11   41   12   8   8   8   20   15   15   15   22   22   73   34   8   8   8   11   34   34   59   59   55   55   55   44   2   2   2   7   57   29   29   29   19   19   19   26   26   26   47   36   36   36   9   9   9   66   33   33   33   64   64   9   9   9   13   12   12   12   14   36   36   33   15   15   15   34   3   3   3   58   52   30   30   30   10   10   10   21   21   21   39   30   30   30   34   27   27}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   61   {}   {}   {}   81   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   91   {}   {}   {}   {}   {}   22   {}   {}   {}   12   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.6.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.7.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   74   74   74   74   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.7.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   90   1   30   {}   {}   {}   31   30   {}   {}   {}   1   40   {}   50   11   81   42   40   {}   50   81   40   {}   {}   50   {}   52   {}   41   81   {}   41   {}   2   30   2   81   82   53   {}   10   {}   {}   81   {}   41   10   81   30   81   {}   3   3   23   {}   3   61   80   {}   94   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.7.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.8.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
} {0   74   74   74   74   99   99   99   99   99   89   96   96   96   96   96   68   91   91   91   99   99   99   99   99   97   97   97   97   97   97   93   93   93   93   84   93   93   93   93   93   86   86   86   91   91   91   91   91   85   85   85   59   59   91   91   91   91   91   90   90   89   89   89   89   56   56   56   56   75   75   89   98   98   98   98   98   94   94   94   94   78   78   78   63   87   87   87   87   87   84   84   84   73   95   95   95   95   96   98   98   98   98   98   74   74   74   73   73   87   87   87   87   87   41   31   31   95   95   95   95   95   88   88   88   88   49   90   90   96   96   96   96   96   77   77   77   85   85   85   85   85   74   74   70   70   59   47   80   90   90   90   90   90   72   72   72   72   93   93   93   93   93   81   81   81   37   37   62   91   91   91   91   91   91   91   99   99   99   99   99   95   95   69   84   84   84   84   84   84   84   58   58   58   58   83   83   83   83   83}

do_execsql_test 1.8.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   23   23   23   2   2   2   2   2   38   38   38   38   38   39   6   6   6   6   6   27   27   27   8   8   8   8   8   29   23   16   16   16   16   16   16   7   7   7   7   7   61   24   24   24   24   12   12   12   3   3   3   3   3   15   15   15   15   15   1   1   1   1   1   16   16   16   16   16   36   36   4   4   4   4   4   30   29   29   29   2   2   2   2   2   37   37   9   9   9   9   9   13   13   13   13   1   1   1   1   1   5   5   5   5   5   11   11   8   8   8   8   8   15   15   15   15   22   22   8   8   8   8   8   11   34   34   55   55   55   44   2   2   2   2   2   7   29   29   19   19   19   19   19   26   26   26   36   36   9   9   9   9   9   33   33   33   33   9   9   9   9   9   12   12   12   12   14   33   15   15   15   15   3   3   3   3   3   30   30   30   10   10   10   10   10   21   21   21   30   30   30   27   27   17   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   61   {}   {}   {}   81   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   91   {}   {}   {}   {}   {}   22   {}   {}   {}   12   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   43   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   33   {}   {}   {}   {}   {}   {}   {}   {}   4   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.8.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.9.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}

do_execsql_test 1.9.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.9.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND CURRENT ROW) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.10.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {74   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.10.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   90   1   30   {}   {}   31   31   30   {}   {}   {}   1   40   {}   50   11   81   42   40   {}   50   81   40   {}   {}   50   {}   52   {}   41   81   {}   41   {}   2   30   2   81   82   53   {}   10   {}   {}   81   {}   41   10   81   30   81   {}   3   3   23   94   3   61   80   {}   94   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.10.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.11.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
} {74   74   74   99   99   99   99   99   99   99   96   96   96   96   96   96   91   91   99   99   99   99   99   99   99   97   97   97   97   97   97   93   93   93   93   93   93   93   93   93   93   86   91   91   91   91   91   91   91   85   85   85   91   91   91   91   91   91   91   90   90   89   89   89   89   56   56   75   75   89   98   98   98   98   98   98   98   94   94   94   94   78   78   87   87   87   87   87   87   87   84   84   95   95   95   95   96   98   98   98   98   98   98   98   74   74   74   87   87   87   87   87   87   87   41   95   95   95   95   95   95   95   88   88   88   90   90   96   96   96   96   96   96   96   77   85   85   85   85   85   85   85   74   74   70   70   80   90   90   90   90   90   90   90   72   72   93   93   93   93   93   93   93   81   81   81   62   91   91   91   91   91   91   91   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   58   58   83   83   83   83   83   83   83}

do_execsql_test 1.11.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
} {0   0   0   0   0   23   2   2   2   2   2   2   2   38   38   38   38   6   6   6   6   6   6   6   27   8   8   8   8   8   8   8   16   16   16   16   16   16   7   7   7   7   7   7   7   24   24   24   12   12   12   3   3   3   3   3   3   3   15   15   15   1   1   1   1   1   1   1   16   16   16   16   16   4   4   4   4   4   4   4   29   29   2   2   2   2   2   2   2   9   9   9   9   9   9   9   13   13   1   1   1   1   1   1   1   5   5   5   5   5   8   8   8   8   8   8   8   15   15   15   15   8   8   8   8   8   8   8   11   34   34   55   44   2   2   2   2   2   2   2   7   19   19   19   19   19   19   19   26   26   26   9   9   9   9   9   9   9   33   33   9   9   9   9   9   9   9   12   12   12   12   14   15   15   15   3   3   3   3   3   3   3   30   10   10   10   10   10   10   10   21   21   21   30   27   27   17   7   7   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   61   {}   {}   {}   81   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   91   {}   {}   {}   {}   {}   22   {}   {}   {}   12   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   43   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   33   {}   {}   {}   {}   {}   {}   {}   {}   4   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   15   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   16   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.11.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.12.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
} {74   99   99   99   99   99   89   96   96   96   96   96   68   91   91   91   99   99   99   99   99   97   97   97   97   97   97   93   93   93   93   84   93   93   93   93   93   86   86   86   91   91   91   91   91   85   85   85   59   59   91   91   91   91   91   90   90   89   89   89   89   56   56   56   56   75   75   89   98   98   98   98   98   94   94   94   94   78   78   78   63   87   87   87   87   87   84   84   84   73   95   95   95   95   96   98   98   98   98   98   74   74   74   73   73   87   87   87   87   87   41   31   31   95   95   95   95   95   88   88   88   88   49   90   90   96   96   96   96   96   77   77   77   85   85   85   85   85   74   74   70   70   59   47   80   90   90   90   90   90   72   72   72   72   93   93   93   93   93   81   81   81   37   37   62   91   91   91   91   91   91   91   99   99   99   99   99   95   95   69   84   84   84   84   84   84   84   58   58   58   58   83   83   83   83   83   82   82   17   7}

do_execsql_test 1.12.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
} {0   23   23   23   2   2   2   2   2   38   38   38   38   38   39   6   6   6   6   6   27   27   27   8   8   8   8   8   29   23   16   16   16   16   16   16   7   7   7   7   7   61   24   24   24   24   12   12   12   3   3   3   3   3   15   15   15   15   15   1   1   1   1   1   16   16   16   16   16   36   36   4   4   4   4   4   30   29   29   29   2   2   2   2   2   37   37   9   9   9   9   9   13   13   13   13   1   1   1   1   1   5   5   5   5   5   11   11   8   8   8   8   8   15   15   15   15   22   22   8   8   8   8   8   11   34   34   55   55   55   44   2   2   2   2   2   7   29   29   19   19   19   19   19   26   26   26   36   36   9   9   9   9   9   33   33   33   33   9   9   9   9   9   12   12   12   12   14   33   15   15   15   15   3   3   3   3   3   30   30   30   10   10   10   10   10   21   21   21   30   30   30   27   27   17   7   7   7   7   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   81   {}   {}   {}   21   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   12   {}   {}   {}   {}   {}   12   {}   {}   {}   72   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   53   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   74   {}   {}   {}   {}   {}   {}   {}   {}   34   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.12.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.13.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
} {74   99   99   99   33   89   89   96   96   96   68   68   68   91   91   91   99   99   99   97   78   78   97   97   97   67   93   93   93   84   77   23   93   93   93   65   47   86   86   86   91   91   91   85   85   85   59   59   56   56   91   91   91   90   90   55   89   89   89   47   56   56   56   56   56   75   75   89   98   98   98   81   94   94   94   78   78   78   53   63   63   87   87   87   84   84   84   72   61   73   95   95   95   65   96   98   98   98   74   74   74   65   73   73   73   87   87   87   41   20   31   31   31   95   95   95   79   88   88   88   34   49   49   90   90   96   96   96   75   77   77   77   44   85   85   85   74   74   70   70   59   39   39   47   80   90   90   90   58   58   72   72   72   72   93   93   93   81   81   81   37   37   37   14   62   91   91   91   91   91   34   36   99   99   99   95   95   69   58   52   84   84   84   84   84   39   44   58   58   58   38   83   83   83   82   82   17   7   {}   {}}

do_execsql_test 1.13.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
} {23   23   23   26   2   2   2   81   59   38   38   38   39   39   46   6   6   6   27   27   27   46   54   8   8   8   29   29   77   23   16   16   16   16   35   35   7   7   7   61   61   61   24   24   24   43   12   12   12   3   3   3   22   22   15   15   15   25   25   1   1   1   40   40   16   16   16   36   36   76   76   4   4   4   30   30   30   29   29   29   2   2   2   37   37   72   41   9   9   9   61   65   13   13   13   58   1   1   1   21   35   5   5   5   11   11   41   12   8   8   8   20   15   15   15   22   22   73   34   8   8   8   11   34   34   59   59   55   55   55   44   2   2   2   7   57   29   29   29   19   19   19   26   26   26   47   36   36   36   9   9   9   66   33   33   33   64   64   9   9   9   13   12   12   12   14   36   36   33   15   15   15   34   3   3   3   58   52   30   30   30   10   10   10   21   21   21   39   30   30   30   34   27   27   17   7   7   7   {}   {}}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
} {40   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   61   {}   {}   {}   51   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   22   {}   {}   {}   {}   {}   2   {}   {}   {}   62   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.13.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.14.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.14.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   74   32   31   84   91   74   3   93   84   74   31   12   90   31   22   74   64   43   64   64   90   74   22   43   90   1   30   62   22   31   31   30   74   64   64   1   40   33   50   11   81   42   40   13   50   81   40   13   13   50   33   52   24   41   81   34   41   34   2   30   2   81   82   53   33   10   33   33   81   34   41   10   81   30   81   4   3   3   23   94   3   61   80   84   94   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.14.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.15.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83}

do_execsql_test 1.15.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
} {0   74   32   31   84   1   14   53   3   84   44   2   93   91   32   52   34   25   33   95   65   61   35   3   74   81   2   91   33   13   23   93   12   5   46   6   82   91   44   2   73   43   84   22   95   82   63   12   75   15   93   35   85   36   33   94   77   83   7   65   43   85   64   95   46   96   33   26   36   65   17   74   74   55   33   25   47   7   47   56   7   87   55   4   58   28   47   15   95   56   7   87   55   46   58   58   26   56   17   16   99   29   7   75   16   38   99   58   98   36   15   6   {}   8   89   9   9   56   {}   97   {}   78   16   28   26   36   {}   59   39   99   27   78   {}   {}   {}   37   27   98   {}   88   8   {}   28   {}   {}   {}   49   37   29   {}   59   {}   {}   47   {}   69   39   59   99   8   78   9   {}   {}   58   49   {}   {}   {}   {}   58   {}   38   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   59   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.15.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.16.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83   82   82   17   7}

do_execsql_test 1.16.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   64   42   81   94   1   44   73   74   44   85   22   33   41   72   93   34   65   54   5   15   81   15   63   84   21   2   62   54   93   43   33   2   75   16   86   23   12   85   62   13   53   94   12   75   23   73   72   96   46   33   55   25   26   74   34   87   84   87   55   53   25   84   75   56   66   54   36   97   55   78   84   84   95   74   65   17   87   77   96   8   47   95   34   89   98   7   46   6   96   8   47   95   56   89   59   36   36   78   96   89   29   37   95   56   39   {}   8   58   67   85   86   {}   58   49   {}   29   76   {}   77   {}   78   56   98   36   97   {}   59   89   89   47   78   {}   {}   {}   38   68   58   {}   58   38   {}   98   {}   {}   {}   19   57   9   {}   9   {}   {}   7   {}   {}   {}   39   89   38   78   39   {}   {}   8   19   {}   {}   {}   {}   89   {}   39   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   9   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.16.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























do_execsql_test 1.17.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83   82   82   17   7   {}   {}   {}   {}}

do_execsql_test 1.17.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
} {1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   {}   {}   {}   {}}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
} {80   84   22   2   34   41   85   23   24   34   25   12   13   11   72   3   85   95   4   75   85   21   65   73   44   31   62   42   4   3   73   13   2   95   56   16   43   2   25   33   83   73   34   72   96   43   13   82   16   16   13   15   65   36   74   14   7   94   47   95   73   65   35   96   36   27   4   67   77   95   78   65   44   5   74   95   78   47   47   36   58   17   5   64   29   58   8   16   86   36   58   17   5   36   29   59   67   26   78   66   49   59   38   6   96   89   {}   38   99   47   26   16   {}   8   19   {}   9   26   {}   87   {}   88   76   58   67   77   {}   9   79   49   37   88   {}   {}   {}   28   98   99   {}   59   39   {}   58   {}   {}   {}   99   27   39   {}   29   {}   {}   8   {}   {}   {}   69   49   39   88   {}   {}   {}   38   99   {}   {}   {}   {}   29   {}   89   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.17.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

























finish_test







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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

317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
...
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
...
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
....
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
....
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
....
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
....
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
....
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
....
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
....
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
....
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
....
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
....
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
....
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
....
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
....
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
....
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   90   1   30   {}   {}   {}   31   30   {}   {}   {}   1   40   {}   50   11   81   42   40   {}   50   81   40   {}   {}   50   {}   52   {}   41   81   {}   41   {}   2   30   2   81   82   53   {}   10   {}   {}   81   {}   41   10   81   30   81   {}   3   3   23   {}   3   61   80   {}   94   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.1.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.1.11.1 {
  SELECT first_value(b) OVER (ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.1.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   38   38   38   38   38   38   38   38   38   38   38   38   38   38   38   38   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.1.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.1.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9}

do_execsql_test 1.1.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.1.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.2.2.1 {
  SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.2.2.2 {
  SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   74   32   31   84   91   74   3   93   84   74   31   12   90   31   22   74   64   43   64   64   90   74   22   43   90   1   30   62   22   31   31   30   74   64   64   1   40   33   50   11   81   42   40   13   50   81   40   13   13   50   33   52   24   41   81   34   41   34   2   30   2   81   82   53   33   10   33   33   81   34   41   10   81   30   81   4   3   3   23   94   3   61   80   84   94   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.2.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.2.11.1 {
  SELECT first_value(b) OVER (ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.2.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   38   38   38   38   38   38   38   38   38   38   38   38   38   38   38   38   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.2.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.2.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9}

do_execsql_test 1.2.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.2.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.3.2.1 {
  SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}

do_execsql_test 1.3.2.2 {
  SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.3.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND CURRENT ROW) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.3.11.1 {
  SELECT first_value(b) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}

do_execsql_test 1.3.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW) FROM t2
} {0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39}

do_execsql_test 1.3.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   1   1   2   2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98   98   99   99   99}

do_execsql_test 1.3.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   10   20   30   30   30   40   50   60   70   80   80   90   90   90   1   1   11   11   21   21   31   31   41   41   41   51   61   61   81   81   81   91   91   91   91   91   2   2   2   12   12   12   22   22   32   42   52   62   62   72   72   72   82   3   3   13   13   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   83   93   93   93   4   14   24   34   34   34   34   44   44   54   64   74   74   74   74   74   84   84   84   84   94   5   15   15   15   25   35   35   55   55   65   65   65   75   75   75   85   85   85   95   95   95   6   16   16   16   26   26   26   36   36   36   36   46   46   56   56   56   66   76   86   96   96   96   7   7   7   17   27   27   37   37   47   47   47   47   57   67   77   77   87   87   97   97   8   8   8   28   38   38   58   58   58   58   68   78   78   88   98   98   9   9   9   19   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89   89   99   99   99}

do_execsql_test 1.3.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39}

do_execsql_test 1.3.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND CURRENT ROW) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.4.2.1 {
  SELECT max(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83   82   82   17   7}

do_execsql_test 1.4.2.2 {
  SELECT min(b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   64   42   81   94   1   44   73   74   44   85   22   33   41   72   93   34   65   54   5   15   81   15   63   84   21   2   62   54   93   43   33   2   75   16   86   23   12   85   62   13   53   94   12   75   23   73   72   96   46   33   55   25   26   74   34   87   84   87   55   53   25   84   75   56   66   54   36   97   55   78   84   84   95   74   65   17   87   77   96   8   47   95   34   89   98   7   46   6   96   8   47   95   56   89   59   36   36   78   96   89   29   37   95   56   39   {}   8   58   67   85   86   {}   58   49   {}   29   76   {}   77   {}   78   56   98   36   97   {}   59   89   89   47   78   {}   {}   {}   38   68   58   {}   58   38   {}   98   {}   {}   {}   19   57   9   {}   9   {}   {}   7   {}   {}   {}   39   89   38   78   39   {}   {}   8   19   {}   {}   {}   {}   89   {}   39   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   9   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.4.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.4.11.1 {
  SELECT first_value(b) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}

do_execsql_test 1.4.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING) FROM t2
} {0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39}

do_execsql_test 1.4.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   1   1   2   2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98   98   99   99   99}

do_execsql_test 1.4.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   10   20   30   30   30   40   50   60   70   80   80   90   90   90   1   1   11   11   21   21   31   31   41   41   41   51   61   61   81   81   81   91   91   91   91   91   2   2   2   12   12   12   22   22   32   42   52   62   62   72   72   72   82   3   3   13   13   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   83   93   93   93   4   14   24   34   34   34   34   44   44   54   64   74   74   74   74   74   84   84   84   84   94   5   15   15   15   25   35   35   55   55   65   65   65   75   75   75   85   85   85   95   95   95   6   16   16   16   26   26   26   36   36   36   36   46   46   56   56   56   66   76   86   96   96   96   7   7   7   17   27   27   37   37   47   47   47   47   57   67   77   77   87   87   97   97   8   8   8   28   38   38   58   58   58   58   68   78   78   88   98   98   9   9   9   19   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89   89   99   99   99}

do_execsql_test 1.4.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39}

do_execsql_test 1.4.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 RANGE BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.5.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{}   {}   {}   {}   0   74   74   74   74   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.5.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{}   {}   {}   {}   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   90   1   30   {}   {}   {}   {}   30   {}   {}   {}   1   40   {}   50   11   81   {}   40   {}   50   81   40   {}   {}   50   {}   {}   {}   41   81   {}   41   {}   2   30   2   81   82   {}   {}   10   {}   {}   81   {}   41   10   81   30   81   {}   {}   3   23   {}   3   61   80   {}   {}   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.5.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.5.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{}   {}   {}   {}   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.5.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{}   {}   {}   {}   0   0   0   0   0   0   0   0   0   0   0   {}   {}   {}   {}   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   {}   {}   {}   {}   2   2   2   2   2   2   2   2   2   2   2   2   2   {}   {}   {}   {}   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   {}   {}   {}   {}   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   {}   {}   {}   {}   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   {}   {}   {}   {}   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   {}   {}   {}   {}   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   {}   {}   {}   {}   38   38   38   38   38   38   38   38   38   38   38   38   {}   {}   {}   {}   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.5.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{}   {}   {}   {}   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.5.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{}   {}   {}   {}   0   0   0   0   0   0   0   0   0   0   0   {}   {}   {}   {}   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   {}   {}   {}   {}   2   2   2   2   2   2   2   2   2   2   2   2   2   {}   {}   {}   {}   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   {}   {}   {}   {}   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   {}   {}   {}   {}   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   {}   {}   {}   {}   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   {}   {}   {}   {}   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   {}   {}   {}   {}   8   8   8   8   8   8   8   8   8   8   8   8   {}   {}   {}   {}   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9}

do_execsql_test 1.5.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
} {{}   {}   {}   {}   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.5.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.6.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
} {{}   {}   0   74   74   74   74   99   99   99   33   89   89   96   96   96   68   68   68   91   91   91   99   99   99   97   78   78   97   97   97   67   93   93   93   84   77   23   93   93   93   65   47   86   86   86   91   91   91   85   85   85   59   59   56   56   91   91   91   90   90   55   89   89   89   47   56   56   56   56   56   75   75   89   98   98   98   81   94   94   94   78   78   78   53   63   63   87   87   87   84   84   84   72   61   73   95   95   95   65   96   98   98   98   74   74   74   65   73   73   73   87   87   87   41   20   31   31   31   95   95   95   79   88   88   88   34   49   49   90   90   96   96   96   75   77   77   77   44   85   85   85   74   74   70   70   59   39   39   47   80   90   90   90   58   58   72   72   72   72   93   93   93   81   81   81   37   37   37   14   62   91   91   91   91   91   34   36   99   99   99   95   95   69   58   52   84   84   84   84   84   39   44   58   58   58   38   83   83   83}

do_execsql_test 1.6.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
} {{}   {}   0   0   0   41   23   23   23   26   2   2   2   81   59   38   38   38   39   39   46   6   6   6   27   27   27   46   54   8   8   8   29   29   77   23   16   16   16   16   35   35   7   7   7   61   61   61   24   24   24   43   12   12   12   3   3   3   22   22   15   15   15   25   25   1   1   1   40   40   16   16   16   36   36   76   76   4   4   4   30   30   30   29   29   29   2   2   2   37   37   72   41   9   9   9   61   65   13   13   13   58   1   1   1   21   35   5   5   5   11   11   41   12   8   8   8   20   15   15   15   22   22   73   34   8   8   8   11   34   34   59   59   55   55   55   44   2   2   2   7   57   29   29   29   19   19   19   26   26   26   47   36   36   36   9   9   9   66   33   33   33   64   64   9   9   9   13   12   12   12   14   36   36   33   15   15   15   34   3   3   3   58   52   30   30   30   10   10   10   21   21   21   39   30   30   30   34   27   27}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   61   {}   {}   {}   81   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   91   {}   {}   {}   {}   {}   22   {}   {}   {}   12   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.6.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.6.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING) FROM t2
} {{}   {}   0   0   0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83}

do_execsql_test 1.6.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING) FROM t2
} {{}   {}   0   0   0   90   40   30   80   20   90   60   70   80   90   {}   {}   41   41   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   {}   {}   2   2   2   62   12   32   22   42   2   72   12   22   2   72   72   {}   {}   23   23   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   {}   {}   74   74   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   {}   {}   65   65   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   {}   {}   26   26   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   {}   {}   97   97   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   {}   {}   38   38   38   68   78   8   28   98   78   58   98   8   88   8   {}   {}   99   99   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9}

do_execsql_test 1.6.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
} {{}   {}   0   0   0   1   1   2   2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98}

do_execsql_test 1.6.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
} {{}   {}   0   0   0   10   20   30   30   30   40   50   60   70   80   {}   {}   1   1   1   1   11   11   21   21   31   31   41   41   41   51   61   61   81   81   81   91   {}   {}   2   2   2   2   2   12   12   12   22   22   32   42   52   62   62   {}   {}   3   3   3   3   13   13   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   {}   {}   4   4   4   14   24   34   34   34   34   44   44   54   64   74   74   74   74   74   84   {}   {}   5   5   5   15   15   15   25   35   35   55   55   65   65   65   75   75   75   85   85   {}   {}   6   6   6   16   16   16   26   26   26   36   36   36   36   46   46   56   56   56   66   76   {}   {}   7   7   7   7   7   17   27   27   37   37   47   47   47   47   57   67   77   77   {}   {}   8   8   8   8   8   28   38   38   58   58   58   58   68   78   {}   {}   9   9   9   9   9   19   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89}

do_execsql_test 1.6.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING ) FROM t2
} {{}   {}   0   0   0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9}

do_execsql_test 1.6.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 PRECEDING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.7.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   74   74   74   74   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.7.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   90   1   30   {}   {}   {}   31   30   {}   {}   {}   1   40   {}   50   11   81   42   40   {}   50   81   40   {}   {}   50   {}   52   {}   41   81   {}   41   {}   2   30   2   81   82   53   {}   10   {}   {}   81   {}   41   10   81   30   81   {}   3   3   23   {}   3   61   80   {}   94   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.7.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.7.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.7.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   38   38   38   38   38   38   38   38   38   38   38   38   38   38   38   38   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.7.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.7.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9}

do_execsql_test 1.7.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.7.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.8.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
} {0   74   74   74   74   99   99   99   99   99   89   96   96   96   96   96   68   91   91   91   99   99   99   99   99   97   97   97   97   97   97   93   93   93   93   84   93   93   93   93   93   86   86   86   91   91   91   91   91   85   85   85   59   59   91   91   91   91   91   90   90   89   89   89   89   56   56   56   56   75   75   89   98   98   98   98   98   94   94   94   94   78   78   78   63   87   87   87   87   87   84   84   84   73   95   95   95   95   96   98   98   98   98   98   74   74   74   73   73   87   87   87   87   87   41   31   31   95   95   95   95   95   88   88   88   88   49   90   90   96   96   96   96   96   77   77   77   85   85   85   85   85   74   74   70   70   59   47   80   90   90   90   90   90   72   72   72   72   93   93   93   93   93   81   81   81   37   37   62   91   91   91   91   91   91   91   99   99   99   99   99   95   95   69   84   84   84   84   84   84   84   58   58   58   58   83   83   83   83   83}

do_execsql_test 1.8.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   23   23   23   2   2   2   2   2   38   38   38   38   38   39   6   6   6   6   6   27   27   27   8   8   8   8   8   29   23   16   16   16   16   16   16   7   7   7   7   7   61   24   24   24   24   12   12   12   3   3   3   3   3   15   15   15   15   15   1   1   1   1   1   16   16   16   16   16   36   36   4   4   4   4   4   30   29   29   29   2   2   2   2   2   37   37   9   9   9   9   9   13   13   13   13   1   1   1   1   1   5   5   5   5   5   11   11   8   8   8   8   8   15   15   15   15   22   22   8   8   8   8   8   11   34   34   55   55   55   44   2   2   2   2   2   7   29   29   19   19   19   19   19   26   26   26   36   36   9   9   9   9   9   33   33   33   33   9   9   9   9   9   12   12   12   12   14   33   15   15   15   15   3   3   3   3   3   30   30   30   10   10   10   10   10   21   21   21   30   30   30   27   27   17   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   61   {}   {}   {}   81   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   91   {}   {}   {}   {}   {}   22   {}   {}   {}   12   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   43   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   33   {}   {}   {}   {}   {}   {}   {}   {}   4   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.8.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.8.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW) FROM t2
} {0   0   0   0   0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83}

do_execsql_test 1.8.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW) FROM t2
} {0   0   0   0   0   90   40   30   80   20   90   60   70   80   90   41   41   41   41   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   2   2   2   2   2   62   12   32   22   42   2   72   12   22   2   72   72   23   23   23   23   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   74   74   74   74   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   65   65   65   65   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   26   26   26   26   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   97   97   97   97   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   38   38   38   38   38   68   78   8   28   98   78   58   98   8   88   8   99   99   99   99   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9}

do_execsql_test 1.8.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   1   1   2   2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98}

do_execsql_test 1.8.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   10   20   30   30   30   40   50   60   70   80   1   1   1   1   1   1   11   11   21   21   31   31   41   41   41   51   61   61   81   81   81   91   2   2   2   2   2   2   2   12   12   12   22   22   32   42   52   62   62   3   3   3   3   3   3   13   13   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   4   4   4   4   4   14   24   34   34   34   34   44   44   54   64   74   74   74   74   74   84   5   5   5   5   5   15   15   15   25   35   35   55   55   65   65   65   75   75   75   85   85   6   6   6   6   6   16   16   16   26   26   26   36   36   36   36   46   46   56   56   56   66   76   7   7   7   7   7   7   7   17   27   27   37   37   47   47   47   47   57   67   77   77   8   8   8   8   8   8   8   28   38   38   58   58   58   58   68   78   9   9   9   9   9   9   9   19   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89}

do_execsql_test 1.8.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW ) FROM t2
} {0   0   0   0   0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9}

do_execsql_test 1.8.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND CURRENT ROW) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.9.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}

do_execsql_test 1.9.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.9.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND CURRENT ROW) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.9.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}

do_execsql_test 1.9.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW) FROM t2
} {0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39}

do_execsql_test 1.9.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   1   1   2   2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98   98   99   99   99}

do_execsql_test 1.9.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   10   20   30   30   30   40   50   60   70   80   80   90   90   90   1   1   11   11   21   21   31   31   41   41   41   51   61   61   81   81   81   91   91   91   91   91   2   2   2   12   12   12   22   22   32   42   52   62   62   72   72   72   82   3   3   13   13   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   83   93   93   93   4   14   24   34   34   34   34   44   44   54   64   74   74   74   74   74   84   84   84   84   94   5   15   15   15   25   35   35   55   55   65   65   65   75   75   75   85   85   85   95   95   95   6   16   16   16   26   26   26   36   36   36   36   46   46   56   56   56   66   76   86   96   96   96   7   7   7   17   27   27   37   37   47   47   47   47   57   67   77   77   87   87   97   97   8   8   8   28   38   38   58   58   58   58   68   78   78   88   98   98   9   9   9   19   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89   89   99   99   99}

do_execsql_test 1.9.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW         AND CURRENT ROW ) FROM t2
} {0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39}

do_execsql_test 1.9.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND CURRENT ROW) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.10.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {74   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.10.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   {}   {}   {}   {}   90   {}   {}   {}   90   1   30   {}   {}   31   31   30   {}   {}   {}   1   40   {}   50   11   81   42   40   {}   50   81   40   {}   {}   50   {}   52   {}   41   81   {}   41   {}   2   30   2   81   82   53   {}   10   {}   {}   81   {}   41   10   81   30   81   {}   3   3   23   94   3   61   80   {}   94   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.10.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.10.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.10.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   38   38   38   38   38   38   38   38   38   38   38   38   38   38   38   38   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.10.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.10.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9}

do_execsql_test 1.10.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.10.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.11.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
} {74   74   74   99   99   99   99   99   99   99   96   96   96   96   96   96   91   91   99   99   99   99   99   99   99   97   97   97   97   97   97   93   93   93   93   93   93   93   93   93   93   86   91   91   91   91   91   91   91   85   85   85   91   91   91   91   91   91   91   90   90   89   89   89   89   56   56   75   75   89   98   98   98   98   98   98   98   94   94   94   94   78   78   87   87   87   87   87   87   87   84   84   95   95   95   95   96   98   98   98   98   98   98   98   74   74   74   87   87   87   87   87   87   87   41   95   95   95   95   95   95   95   88   88   88   90   90   96   96   96   96   96   96   96   77   85   85   85   85   85   85   85   74   74   70   70   80   90   90   90   90   90   90   90   72   72   93   93   93   93   93   93   93   81   81   81   62   91   91   91   91   91   91   91   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   58   58   83   83   83   83   83   83   83}

do_execsql_test 1.11.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
} {0   0   0   0   0   23   2   2   2   2   2   2   2   38   38   38   38   6   6   6   6   6   6   6   27   8   8   8   8   8   8   8   16   16   16   16   16   16   7   7   7   7   7   7   7   24   24   24   12   12   12   3   3   3   3   3   3   3   15   15   15   1   1   1   1   1   1   1   16   16   16   16   16   4   4   4   4   4   4   4   29   29   2   2   2   2   2   2   2   9   9   9   9   9   9   9   13   13   1   1   1   1   1   1   1   5   5   5   5   5   8   8   8   8   8   8   8   15   15   15   15   8   8   8   8   8   8   8   11   34   34   55   44   2   2   2   2   2   2   2   7   19   19   19   19   19   19   19   26   26   26   9   9   9   9   9   9   9   33   33   9   9   9   9   9   9   9   12   12   12   12   14   15   15   15   3   3   3   3   3   3   3   30   10   10   10   10   10   10   10   21   21   21   30   27   27   17   7   7   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   61   {}   {}   {}   81   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   91   {}   {}   {}   {}   {}   22   {}   {}   {}   12   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   43   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   33   {}   {}   {}   {}   {}   {}   {}   {}   4   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   15   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   16   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.11.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.11.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING) FROM t2
} {0   0   0   0   0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83}

do_execsql_test 1.11.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING) FROM t2
} {0   0   0   0   0   90   40   30   80   20   90   60   70   80   90   41   41   41   41   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   2   2   2   2   2   62   12   32   22   42   2   72   12   22   2   72   72   23   23   23   23   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   74   74   74   74   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   65   65   65   65   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   26   26   26   26   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   97   97   97   97   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   38   38   38   38   38   68   78   8   28   98   78   58   98   8   88   8   99   99   99   99   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9}

do_execsql_test 1.11.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
} {0   0   0   0   0   1   1   2   2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98}

do_execsql_test 1.11.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
} {0   0   0   0   0   10   20   30   30   30   40   50   60   70   80   1   1   1   1   1   1   11   11   21   21   31   31   41   41   41   51   61   61   81   81   81   91   2   2   2   2   2   2   2   12   12   12   22   22   32   42   52   62   62   3   3   3   3   3   3   13   13   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   4   4   4   4   4   14   24   34   34   34   34   44   44   54   64   74   74   74   74   74   84   5   5   5   5   5   15   15   15   25   35   35   55   55   65   65   65   75   75   75   85   85   6   6   6   6   6   16   16   16   26   26   26   36   36   36   36   46   46   56   56   56   66   76   7   7   7   7   7   7   7   17   27   27   37   37   47   47   47   47   57   67   77   77   8   8   8   8   8   8   8   28   38   38   58   58   58   58   68   78   9   9   9   9   9   9   9   19   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89}

do_execsql_test 1.11.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING ) FROM t2
} {0   0   0   0   0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9}

do_execsql_test 1.11.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND 2 FOLLOWING) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.12.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
} {74   99   99   99   99   99   89   96   96   96   96   96   68   91   91   91   99   99   99   99   99   97   97   97   97   97   97   93   93   93   93   84   93   93   93   93   93   86   86   86   91   91   91   91   91   85   85   85   59   59   91   91   91   91   91   90   90   89   89   89   89   56   56   56   56   75   75   89   98   98   98   98   98   94   94   94   94   78   78   78   63   87   87   87   87   87   84   84   84   73   95   95   95   95   96   98   98   98   98   98   74   74   74   73   73   87   87   87   87   87   41   31   31   95   95   95   95   95   88   88   88   88   49   90   90   96   96   96   96   96   77   77   77   85   85   85   85   85   74   74   70   70   59   47   80   90   90   90   90   90   72   72   72   72   93   93   93   93   93   81   81   81   37   37   62   91   91   91   91   91   91   91   99   99   99   99   99   95   95   69   84   84   84   84   84   84   84   58   58   58   58   83   83   83   83   83   82   82   17   7}

do_execsql_test 1.12.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
} {0   23   23   23   2   2   2   2   2   38   38   38   38   38   39   6   6   6   6   6   27   27   27   8   8   8   8   8   29   23   16   16   16   16   16   16   7   7   7   7   7   61   24   24   24   24   12   12   12   3   3   3   3   3   15   15   15   15   15   1   1   1   1   1   16   16   16   16   16   36   36   4   4   4   4   4   30   29   29   29   2   2   2   2   2   37   37   9   9   9   9   9   13   13   13   13   1   1   1   1   1   5   5   5   5   5   11   11   8   8   8   8   8   15   15   15   15   22   22   8   8   8   8   8   11   34   34   55   55   55   44   2   2   2   2   2   7   29   29   19   19   19   19   19   26   26   26   36   36   9   9   9   9   9   33   33   33   33   9   9   9   9   9   12   12   12   12   14   33   15   15   15   15   3   3   3   3   3   30   30   30   10   10   10   10   10   21   21   21   30   30   30   27   27   17   7   7   7   7   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   81   {}   {}   {}   21   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   12   {}   {}   {}   {}   {}   12   {}   {}   {}   72   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   53   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   74   {}   {}   {}   {}   {}   {}   {}   {}   34   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.12.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.12.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}

do_execsql_test 1.12.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING) FROM t2
} {0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39}

do_execsql_test 1.12.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
} {0   1   1   2   2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98   98   99   99   99}

do_execsql_test 1.12.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
} {0   10   20   30   30   30   40   50   60   70   80   80   90   90   90   1   1   11   11   21   21   31   31   41   41   41   51   61   61   81   81   81   91   91   91   91   91   2   2   2   12   12   12   22   22   32   42   52   62   62   72   72   72   82   3   3   13   13   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   83   93   93   93   4   14   24   34   34   34   34   44   44   54   64   74   74   74   74   74   84   84   84   84   94   5   15   15   15   25   35   35   55   55   65   65   65   75   75   75   85   85   85   95   95   95   6   16   16   16   26   26   26   36   36   36   36   46   46   56   56   56   66   76   86   96   96   96   7   7   7   17   27   27   37   37   47   47   47   47   57   67   77   77   87   87   97   97   8   8   8   28   38   38   58   58   58   58   68   78   78   88   98   98   9   9   9   19   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89   89   99   99   99}

do_execsql_test 1.12.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING ) FROM t2
} {0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39}

do_execsql_test 1.12.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND 4 FOLLOWING) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.13.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
} {74   99   99   99   33   89   89   96   96   96   68   68   68   91   91   91   99   99   99   97   78   78   97   97   97   67   93   93   93   84   77   23   93   93   93   65   47   86   86   86   91   91   91   85   85   85   59   59   56   56   91   91   91   90   90   55   89   89   89   47   56   56   56   56   56   75   75   89   98   98   98   81   94   94   94   78   78   78   53   63   63   87   87   87   84   84   84   72   61   73   95   95   95   65   96   98   98   98   74   74   74   65   73   73   73   87   87   87   41   20   31   31   31   95   95   95   79   88   88   88   34   49   49   90   90   96   96   96   75   77   77   77   44   85   85   85   74   74   70   70   59   39   39   47   80   90   90   90   58   58   72   72   72   72   93   93   93   81   81   81   37   37   37   14   62   91   91   91   91   91   34   36   99   99   99   95   95   69   58   52   84   84   84   84   84   39   44   58   58   58   38   83   83   83   82   82   17   7   {}   {}}

do_execsql_test 1.13.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
} {23   23   23   26   2   2   2   81   59   38   38   38   39   39   46   6   6   6   27   27   27   46   54   8   8   8   29   29   77   23   16   16   16   16   35   35   7   7   7   61   61   61   24   24   24   43   12   12   12   3   3   3   22   22   15   15   15   25   25   1   1   1   40   40   16   16   16   36   36   76   76   4   4   4   30   30   30   29   29   29   2   2   2   37   37   72   41   9   9   9   61   65   13   13   13   58   1   1   1   21   35   5   5   5   11   11   41   12   8   8   8   20   15   15   15   22   22   73   34   8   8   8   11   34   34   59   59   55   55   55   44   2   2   2   7   57   29   29   29   19   19   19   26   26   26   47   36   36   36   9   9   9   66   33   33   33   64   64   9   9   9   13   12   12   12   14   36   36   33   15   15   15   34   3   3   3   58   52   30   30   30   10   10   10   21   21   21   39   30   30   30   34   27   27   17   7   7   7   {}   {}}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
} {40   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   61   {}   {}   {}   51   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   22   {}   {}   {}   {}   {}   2   {}   {}   {}   62   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.13.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.13.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING) FROM t2
} {41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7   {}   {}}

do_execsql_test 1.13.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING) FROM t2
} {40   30   80   20   90   60   70   80   90   30   50   10   30   {}   {}   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   {}   {}   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   {}   {}   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   {}   {}   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   {}   {}   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   {}   {}   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   {}   {}   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   {}   {}   78   8   28   98   78   58   98   8   88   8   58   58   58   38   {}   {}   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39   {}   {}}

do_execsql_test 1.13.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
} {1   2   2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98   98   99   99   99   {}   {}}

do_execsql_test 1.13.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
} {20   30   30   30   40   50   60   70   80   80   90   90   90   {}   {}   11   11   21   21   31   31   41   41   41   51   61   61   81   81   81   91   91   91   91   91   {}   {}   2   12   12   12   22   22   32   42   52   62   62   72   72   72   82   {}   {}   13   13   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   83   93   93   93   {}   {}   24   34   34   34   34   44   44   54   64   74   74   74   74   74   84   84   84   84   94   {}   {}   15   15   25   35   35   55   55   65   65   65   75   75   75   85   85   85   95   95   95   {}   {}   16   16   26   26   26   36   36   36   36   46   46   56   56   56   66   76   86   96   96   96   {}   {}   7   17   27   27   37   37   47   47   47   47   57   67   77   77   87   87   97   97   {}   {}   8   28   38   38   58   58   58   58   68   78   78   88   98   98   {}   {}   9   19   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89   89   99   99   99   {}   {}}

do_execsql_test 1.13.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING ) FROM t2
} {40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39   {}   {}}

do_execsql_test 1.13.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 2 FOLLOWING    AND 4 FOLLOWING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.14.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.14.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   74   32   31   84   91   74   3   93   84   74   31   12   90   31   22   74   64   43   64   64   90   74   22   43   90   1   30   62   22   31   31   30   74   64   64   1   40   33   50   11   81   42   40   13   50   81   40   13   13   50   33   52   24   41   81   34   41   34   2   30   2   81   82   53   33   10   33   33   81   34   41   10   81   30   81   4   3   3   23   94   3   61   80   84   94   3   91   91   72   3   63   30   91   94   94   72   91   73   91   84   84   33   41   1   33   84   73   73   91   20   41   84   33   33   84   33   41   84   21   44   22   90   22   81   81   74   93   93   93   81   21   83   44   44   21   21   21   13   21   21   34   11   34   73   74   2   60   2   34   2   34   74   60   23   2   2   2   11   91   60   62   73   74   70   51   65   74   93   65   70   34   70   93   93   93   62   35   44   43   12   35   41   43   44   44   41   80   54   72   43   41   43   91   12   80   80   35   33   12}

do_execsql_test 1.14.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.14.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.14.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   41   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   23   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   74   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   65   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   26   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   97   38   38   38   38   38   38   38   38   38   38   38   38   38   38   38   38   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99}

do_execsql_test 1.14.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.14.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   4   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   5   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   6   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   8   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9   9}

do_execsql_test 1.14.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0}

do_execsql_test 1.14.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.15.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83}

do_execsql_test 1.15.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
} {0   74   32   31   84   1   14   53   3   84   44   2   93   91   32   52   34   25   33   95   65   61   35   3   74   81   2   91   33   13   23   93   12   5   46   6   82   91   44   2   73   43   84   22   95   82   63   12   75   15   93   35   85   36   33   94   77   83   7   65   43   85   64   95   46   96   33   26   36   65   17   74   74   55   33   25   47   7   47   56   7   87   55   4   58   28   47   15   95   56   7   87   55   46   58   58   26   56   17   16   99   29   7   75   16   38   99   58   98   36   15   6   {}   8   89   9   9   56   {}   97   {}   78   16   28   26   36   {}   59   39   99   27   78   {}   {}   {}   37   27   98   {}   88   8   {}   28   {}   {}   {}   49   37   29   {}   59   {}   {}   47   {}   69   39   59   99   8   78   9   {}   {}   58   49   {}   {}   {}   {}   58   {}   38   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   59   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.15.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.15.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING) FROM t2
} {0   0   0   0   0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83}

do_execsql_test 1.15.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING) FROM t2
} {0   0   0   0   0   90   40   30   80   20   90   60   70   80   90   41   41   41   41   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   2   2   2   2   2   62   12   32   22   42   2   72   12   22   2   72   72   23   23   23   23   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   74   74   74   74   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   65   65   65   65   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   26   26   26   26   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   97   97   97   97   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   38   38   38   38   38   68   78   8   28   98   78   58   98   8   88   8   99   99   99   99   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9}

do_execsql_test 1.15.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   1   1   2   2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98}

do_execsql_test 1.15.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   10   20   30   30   30   40   50   60   70   80   1   1   1   1   1   1   11   11   21   21   31   31   41   41   41   51   61   61   81   81   81   91   2   2   2   2   2   2   2   12   12   12   22   22   32   42   52   62   62   3   3   3   3   3   3   13   13   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   4   4   4   4   4   14   24   34   34   34   34   44   44   54   64   74   74   74   74   74   84   5   5   5   5   5   15   15   15   25   35   35   55   55   65   65   65   75   75   75   85   85   6   6   6   6   6   16   16   16   26   26   26   36   36   36   36   46   46   56   56   56   66   76   7   7   7   7   7   7   7   17   27   27   37   37   47   47   47   47   57   67   77   77   8   8   8   8   8   8   8   28   38   38   58   58   58   58   68   78   9   9   9   9   9   9   9   19   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89}

do_execsql_test 1.15.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING ) FROM t2
} {0   0   0   0   0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9}

do_execsql_test 1.15.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 PRECEDING    AND UNBOUNDED FOLLOWING) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.16.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83   82   82   17   7}

do_execsql_test 1.16.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   64   42   81   94   1   44   73   74   44   85   22   33   41   72   93   34   65   54   5   15   81   15   63   84   21   2   62   54   93   43   33   2   75   16   86   23   12   85   62   13   53   94   12   75   23   73   72   96   46   33   55   25   26   74   34   87   84   87   55   53   25   84   75   56   66   54   36   97   55   78   84   84   95   74   65   17   87   77   96   8   47   95   34   89   98   7   46   6   96   8   47   95   56   89   59   36   36   78   96   89   29   37   95   56   39   {}   8   58   67   85   86   {}   58   49   {}   29   76   {}   77   {}   78   56   98   36   97   {}   59   89   89   47   78   {}   {}   {}   38   68   58   {}   58   38   {}   98   {}   {}   {}   19   57   9   {}   9   {}   {}   7   {}   {}   {}   39   89   38   78   39   {}   {}   8   19   {}   {}   {}   {}   89   {}   39   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   9   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.16.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING) FROM t2
} {0   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.16.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING) FROM t2
} {0   74   41   74   23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7}

do_execsql_test 1.16.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING) FROM t2
} {0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39}

do_execsql_test 1.16.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   1   1   2   2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98   98   99   99   99}

do_execsql_test 1.16.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   10   20   30   30   30   40   50   60   70   80   80   90   90   90   1   1   11   11   21   21   31   31   41   41   41   51   61   61   81   81   81   91   91   91   91   91   2   2   2   12   12   12   22   22   32   42   52   62   62   72   72   72   82   3   3   13   13   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   83   93   93   93   4   14   24   34   34   34   34   44   44   54   64   74   74   74   74   74   84   84   84   84   94   5   15   15   15   25   35   35   55   55   65   65   65   75   75   75   85   85   85   95   95   95   6   16   16   16   26   26   26   36   36   36   36   46   46   56   56   56   66   76   86   96   96   96   7   7   7   17   27   27   37   37   47   47   47   47   57   67   77   77   87   87   97   97   8   8   8   28   38   38   58   58   58   58   68   78   78   88   98   98   9   9   9   19   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89   89   99   99   99}

do_execsql_test 1.16.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING ) FROM t2
} {0   90   40   30   80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39}

do_execsql_test 1.16.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN CURRENT ROW         AND UNBOUNDED FOLLOWING) FROM t2
} {0   74   74   26   2   96   38   68   62   46   6   46   78   54   8   84   16   16   86   74   24   12   32   56   22   90   28   56   40   56   16   36   98   76   4   94   42   30   78   2   80   84   72   58   96   98   74   12   8   20   22   88   34   8   34   90   96   60   44   2   74   70   26   26   80   90   36   58   72   72   66   64   12   14   62   36   34   36   58   52   30   50   84   10   84   44   58   30   38   34   82   41   23   99   33   89   81   59   39   91   99   97   27   97   67   29   93   77   23   93   65   35   47   7   61   91   85   85   43   59   3   91   55   15   89   25   47   1   43   75   89   81   33   29   53   63   87   37   41   9   61   73   95   65   13   1   21   65   35   5   73   11   51   87   41   31   31   15   95   73   79   11   49   59   55   75   77   7   85   57   29   59   19   39   47   47   9   33   93   75   81   9   23   37   13   91   91   33   15   99   3   95   69   33   21   39   83   27   17   7}

do_execsql_test 1.17.2.1 {
  SELECT max(b) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
} {99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   99   95   95   84   84   84   84   84   84   84   84   83   83   83   83   83   83   83   83   83   82   82   17   7   {}   {}   {}   {}}

do_execsql_test 1.17.2.2 {
  SELECT min(b) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
} {1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   {}   {}   {}   {}}
................................................................................
  SELECT nth_value(b,b+1) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
} {80   84   22   2   34   41   85   23   24   34   25   12   13   11   72   3   85   95   4   75   85   21   65   73   44   31   62   42   4   3   73   13   2   95   56   16   43   2   25   33   83   73   34   72   96   43   13   82   16   16   13   15   65   36   74   14   7   94   47   95   73   65   35   96   36   27   4   67   77   95   78   65   44   5   74   95   78   47   47   36   58   17   5   64   29   58   8   16   86   36   58   17   5   36   29   59   67   26   78   66   49   59   38   6   96   89   {}   38   99   47   26   16   {}   8   19   {}   9   26   {}   87   {}   88   76   58   67   77   {}   9   79   49   37   88   {}   {}   {}   28   98   99   {}   59   39   {}   58   {}   {}   {}   99   27   39   {}   29   {}   {}   8   {}   {}   {}   69   49   39   88   {}   {}   {}   38   99   {}   {}   {}   {}   29   {}   89   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.17.10.6 {
  SELECT nth_value(b,b+1) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

do_execsql_test 1.17.11.1 {
  SELECT first_value(b) OVER (ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING) FROM t2
} {23   99   26   33   2   89   81   96   59   38   68   39   62   91   46   6   99   97   27   46   78   54   97   8   67   29   93   84   77   23   16   16   93   65   35   47   7   86   74   61   91   85   24   85   43   59   12   32   56   3   91   22   90   55   15   28   89   25   47   1   56   40   43   56   16   75   36   89   98   76   81   4   94   42   30   78   33   29   53   63   2   87   37   80   84   72   41   9   61   73   95   65   13   58   96   98   1   21   74   65   35   5   73   11   51   87   41   12   8   20   31   31   15   95   22   73   79   88   34   8   11   49   34   90   59   96   60   55   75   77   44   2   7   85   57   74   29   70   59   19   39   26   26   47   80   90   36   58   47   9   72   72   66   33   93   75   64   81   9   23   37   13   12   14   62   91   36   91   33   15   34   36   99   3   95   69   58   52   30   50   84   10   84   33   21   39   44   58   30   38   34   83   27   82   17   7   {}   {}   {}   {}}

do_execsql_test 1.17.11.2 {
  SELECT first_value(b) OVER (PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING) FROM t2
} {80   20   90   60   70   80   90   30   50   10   30   {}   {}   {}   {}   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   {}   {}   {}   {}   22   42   2   72   12   22   2   72   72   12   62   52   82   {}   {}   {}   {}   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   {}   {}   {}   {}   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   {}   {}   {}   {}   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   {}   {}   {}   {}   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   {}   {}   {}   {}   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   {}   {}   {}   {}   28   98   78   58   98   8   88   8   58   58   58   38   {}   {}   {}   {}   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39   {}   {}   {}   {}}

do_execsql_test 1.17.11.3 {
  SELECT first_value(b) OVER ( ORDER BY b,a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
} {2   2   3   3   4   5   6   7   7   7   8   8   8   9   9   9   10   11   11   12   12   12   13   13   14   15   15   15   16   16   16   17   19   20   21   21   22   22   23   23   23   24   25   26   26   26   27   27   28   29   29   29   30   30   30   31   31   32   33   33   33   33   33   34   34   34   34   35   35   36   36   36   36   37   37   38   38   39   39   39   40   41   41   41   42   43   43   44   44   46   46   47   47   47   47   49   50   51   52   53   54   55   55   56   56   56   57   58   58   58   58   59   59   59   59   60   61   61   62   62   63   64   65   65   65   66   67   68   69   70   72   72   72   73   73   73   74   74   74   74   74   75   75   75   76   77   77   78   78   79   80   80   81   81   81   82   83   84   84   84   84   85   85   85   86   87   87   88   89   89   89   90   90   90   91   91   91   91   91   93   93   93   94   95   95   95   96   96   96   97   97   98   98   99   99   99   {}   {}   {}   {}}

do_execsql_test 1.17.11.4 {
  SELECT first_value(b) OVER ( PARTITION BY b%10 ORDER BY b,a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
} {30   30   40   50   60   70   80   80   90   90   90   {}   {}   {}   {}   21   21   31   31   41   41   41   51   61   61   81   81   81   91   91   91   91   91   {}   {}   {}   {}   12   12   22   22   32   42   52   62   62   72   72   72   82   {}   {}   {}   {}   23   23   23   33   33   33   33   33   43   43   53   63   73   73   73   83   93   93   93   {}   {}   {}   {}   34   34   34   44   44   54   64   74   74   74   74   74   84   84   84   84   94   {}   {}   {}   {}   25   35   35   55   55   65   65   65   75   75   75   85   85   85   95   95   95   {}   {}   {}   {}   26   26   26   36   36   36   36   46   46   56   56   56   66   76   86   96   96   96   {}   {}   {}   {}   27   27   37   37   47   47   47   47   57   67   77   77   87   87   97   97   {}   {}   {}   {}   38   38   58   58   58   58   68   78   78   88   98   98   {}   {}   {}   {}   29   29   29   39   39   39   49   59   59   59   59   69   79   89   89   89   99   99   99   {}   {}   {}   {}}

do_execsql_test 1.17.11.5 {
  SELECT first_value(b) OVER ( ORDER BY b%10,a ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING ) FROM t2
} {80   20   90   60   70   80   90   30   50   10   30   41   81   91   61   91   91   1   81   41   61   1   21   11   51   41   31   31   11   81   91   91   21   2   62   12   32   22   42   2   72   12   22   2   72   72   12   62   52   82   23   33   93   23   93   43   3   43   33   53   63   73   13   73   73   33   93   23   13   33   3   33   83   74   74   54   84   74   24   4   94   84   74   34   34   44   74   64   14   34   84   84   44   34   65   35   85   85   55   15   25   75   95   65   65   35   5   15   95   55   75   85   75   15   95   26   96   46   6   46   16   16   86   56   56   56   16   36   76   96   96   26   26   36   66   36   36   97   27   97   67   77   47   7   47   87   37   87   77   7   57   47   47   37   27   17   7   38   68   78   8   28   98   78   58   98   8   88   8   58   58   58   38   99   89   59   39   99   29   59   89   89   29   9   79   49   59   29   59   19   39   9   9   99   69   39   {}   {}   {}   {}}

do_execsql_test 1.17.11.6 {
  SELECT first_value(b) OVER (PARTITION BY b%2,a ORDER BY b%10 ROWS BETWEEN 4 FOLLOWING    AND UNBOUNDED FOLLOWING) FROM t2
} {{}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}   {}}

finish_test