Add tests to improve coverage of code in window.c. Fix a problem with "SELECT
row_number() OVER ()". FossilOrigin-Name: f41b6b7317e2b5ac5721a3adff49f298ded29f9e0f887af98faeb0cb7e865ab6
This commit is contained in:
parent
85b9a1c2fb
commit
9c27758eb4
22
manifest
22
manifest
@ -1,5 +1,5 @@
|
||||
C Merge\slatest\strunk\schanges\swith\sthis\sbranch.
|
||||
D 2018-06-19T19:15:25.540
|
||||
C Add\stests\sto\simprove\scoverage\sof\scode\sin\swindow.c.\sFix\sa\sproblem\swith\s"SELECT\nrow_number()\sOVER\s()".
|
||||
D 2018-06-20T09:23:49.155
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F Makefile.in 0a3a6c81e6fcb969ff9106e882f0a08547014ba463cb6beca4c4efaecc924ee6
|
||||
@ -567,9 +567,9 @@ F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5
|
||||
F src/util.c d9eb0a6c4aae1b00a7369eadd7ca0bbe946cb4c953b6751aa20d357c2f482157
|
||||
F src/vacuum.c 36e7d21a20c0bf6ef4ef7c399d192b5239410b7c4d3c1070fba4e30810d0b855
|
||||
F src/vdbe.c 16385bc816c97cc28c12ffa2151b8dc80617943b2e5871e7f0c9fdb4392c2c18
|
||||
F src/vdbe.h 9c8c245fa3785266c269ab02c135c836ff49a307612186686bcdae500f409945
|
||||
F src/vdbe.h 847735b3e083285aa225d2bf1fe97107a0a2b8942c80d643cdb764990705820d
|
||||
F src/vdbeInt.h d99f1c3da17b4ed271efc2f52898dd9a577dee077da47c2a014bc128f3cdba2a
|
||||
F src/vdbeapi.c af4a3de00d1851bcbc55b85dfbe52849aa2b1e17b4a5a1f3d9c257df7af361ff
|
||||
F src/vdbeapi.c e35f813312b0f6e8e2835b357f121e0d1da6d3013bac3e367fe4efd518e7a2ec
|
||||
F src/vdbeaux.c c2d65c763b0811afe409e02e9d0d1f300c6e97892474fc94eec3da71955cd418
|
||||
F src/vdbeblob.c f5c70f973ea3a9e915d1693278a5f890dc78594300cf4d54e64f2b0917c94191
|
||||
F src/vdbemem.c b8f3bb3bed82774ee352fa3405c83de2fc3e528638adfd3d15fa9a0da5c03d07
|
||||
@ -584,7 +584,7 @@ F src/where.c 0bcbf9e191ca07f9ea2008aa80e70ded46bcdffd26560c83397da501f00aece6
|
||||
F src/whereInt.h b90ef9b9707ef750eab2a7a080c48fb4900315033274689def32d0cf5a81ebe4
|
||||
F src/wherecode.c 3317f2b083a66d3e65a03edf316ade4ccb0a99c9956273282ebb579b95d4ba96
|
||||
F src/whereexpr.c 19cf35cdd9bf6d5589d8a5c960d99259761136187a2319a6e14d11cf1abe14c2
|
||||
F src/window.c 32a747702eed5cfb2184f8932d93d5a0688ab48076bc3c7ac90325647bc72304
|
||||
F src/window.c 79be282a3602a435ec4991163823cf8af0a8a86187fe7e0518873c8814cdfcf3
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
|
||||
F test/affinity3.test 6a101af2fc945ce2912f6fe54dd646018551710d
|
||||
@ -1621,12 +1621,12 @@ F test/win32nolock.test ac4f08811a562e45a5755e661f45ca85892bdbbc
|
||||
F test/window1.test c4c138b1207bfdb5cd8edb2671f6e40040713b3e44bd156f6f8960bdf358ae2e
|
||||
F test/window2.tcl 0983de5eade5eeda49469244799d5331bfe3199fca3f6c6d2a836aa08f4fba1b
|
||||
F test/window2.test 79747b2edde4ad424e0752b27529aedc86e91f3d8d88846fa17ff0cb67f65086
|
||||
F test/window3.tcl 654d61d73e10db089b22514d498bb23ec310f720c0f4b5f69f67fda83d672048
|
||||
F test/window3.test 41727668ee31d2ba50f78efcb5bf1bda2c5cffd889aa65243511004669d1ac25
|
||||
F test/window3.tcl c770a8a8eff32eec632d2745894bfdb2b732d6e450caa7258cf264196592429f
|
||||
F test/window3.test 3c2c768e053453dd12176df0d420b4a3b2661bf1116d67c926b1a0083608fe3e
|
||||
F test/window4.tcl ce0c14185ba651de53994df8ac11da472b6bbd3534e148ad3ce87de6aa0426ed
|
||||
F test/window4.test 13b8cac12e78017d6c1873742efcb120f3d5b2debfdb412271bfb84969087037
|
||||
F test/window5.test fbf14119adb71a2640ec876436c5cc0c304a72f863bff41673c413a2a194646b
|
||||
F test/windowfault.test 7d3655fcac44c903b1aa31d40e13d170c71b089551f0e6ed17b02f66fb731fb6
|
||||
F test/windowfault.test a3f239a78557554140ccde491371e17d7b58380aafd796554fc9a43527af9dfc
|
||||
F test/with1.test 58475190cd8caaeebea8cfeb2a264ec97a0c492b8ffe9ad20cefbb23df462f96
|
||||
F test/with2.test e0030e2f0267a910d6c0e4f46f2dfe941c1cc0d4f659ba69b3597728e7e8f1ab
|
||||
F test/with3.test 5e8ce2c585170bbbc0544e2a01a4941fa0be173ba5265e5c92eb588cd99a232d
|
||||
@ -1743,7 +1743,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P f4b1b6f85b53d72e735a1382f7c3de75af405a7878dd8cdcb10394e859ea3d69 320fa69e6aa2a7d67f6444d6c13de9893e27b85c36a933b06da113d753b6aafc
|
||||
R 3f551934a344252426be710507621310
|
||||
P 6ad0e64b465959c50d4c895c053b15ee7efed11b6427604d2eab88635d9f7319
|
||||
R 30e5379558b21c58011238fd5e61a227
|
||||
U dan
|
||||
Z d27470b28751518c2f266e1267cc19e0
|
||||
Z 2a2f3fa673903a56da8ae784bde98feb
|
||||
|
@ -1 +1 @@
|
||||
6ad0e64b465959c50d4c895c053b15ee7efed11b6427604d2eab88635d9f7319
|
||||
f41b6b7317e2b5ac5721a3adff49f298ded29f9e0f887af98faeb0cb7e865ab6
|
@ -243,6 +243,7 @@ void sqlite3VdbeResolveLabel(Vdbe*, int);
|
||||
int sqlite3VdbeCurrentAddr(Vdbe*);
|
||||
#ifdef SQLITE_DEBUG
|
||||
int sqlite3VdbeAssertMayAbort(Vdbe *, int);
|
||||
int sqlite3VdbeAssertAggContext(sqlite3_context*);
|
||||
#endif
|
||||
void sqlite3VdbeResetStepResult(Vdbe*);
|
||||
void sqlite3VdbeRewind(Vdbe*);
|
||||
|
@ -824,6 +824,18 @@ void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** This function is only used within assert() statements to check that the
|
||||
** aggregate context has already been allocated. i.e.:
|
||||
**
|
||||
** assert( sqlite3VdbeAssertAggContext(p) );
|
||||
*/
|
||||
#ifdef SQLITE_DEBUG
|
||||
int sqlite3VdbeAssertAggContext(sqlite3_context *p){
|
||||
return ((p->pMem->flags & MEM_Agg)!=0);
|
||||
}
|
||||
#endif /* SQLITE_DEBUG */
|
||||
|
||||
/*
|
||||
** Return the auxiliary data pointer, if any, for the iArg'th argument to
|
||||
** the user-function defined by pCtx.
|
||||
|
52
src/window.c
52
src/window.c
@ -172,7 +172,10 @@ struct CallCount {
|
||||
};
|
||||
|
||||
/*
|
||||
** Implementation of built-in window function dense_rank().
|
||||
** Implementation of built-in window function dense_rank(). Assumes that
|
||||
** the window frame has been set to:
|
||||
**
|
||||
** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
|
||||
*/
|
||||
static void dense_rankStepFunc(
|
||||
sqlite3_context *pCtx,
|
||||
@ -202,7 +205,10 @@ static void dense_rankValueFunc(sqlite3_context *pCtx){
|
||||
}
|
||||
|
||||
/*
|
||||
** Implementation of built-in window function rank().
|
||||
** Implementation of built-in window function rank(). Assumes that
|
||||
** the window frame has been set to:
|
||||
**
|
||||
** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
|
||||
*/
|
||||
static void rankStepFunc(
|
||||
sqlite3_context *pCtx,
|
||||
@ -234,7 +240,10 @@ static void rankValueFunc(sqlite3_context *pCtx){
|
||||
}
|
||||
|
||||
/*
|
||||
** Implementation of built-in window function percent_rank().
|
||||
** Implementation of built-in window function percent_rank(). Assumes that
|
||||
** the window frame has been set to:
|
||||
**
|
||||
** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
|
||||
*/
|
||||
static void percent_rankStepFunc(
|
||||
sqlite3_context *pCtx,
|
||||
@ -244,8 +253,9 @@ static void percent_rankStepFunc(
|
||||
struct CallCount *p;
|
||||
assert( nArg==1 );
|
||||
|
||||
assert( sqlite3VdbeAssertAggContext(pCtx) );
|
||||
p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
if( p ){
|
||||
if( ALWAYS(p) ){
|
||||
if( p->nTotal==0 ){
|
||||
p->nTotal = sqlite3_value_int64(apArg[0]);
|
||||
}
|
||||
@ -275,6 +285,12 @@ static void percent_rankValueFunc(sqlite3_context *pCtx){
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Implementation of built-in window function cume_dist(). Assumes that
|
||||
** the window frame has been set to:
|
||||
**
|
||||
** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
|
||||
*/
|
||||
static void cume_distStepFunc(
|
||||
sqlite3_context *pCtx,
|
||||
int nArg,
|
||||
@ -283,8 +299,9 @@ static void cume_distStepFunc(
|
||||
struct CallCount *p;
|
||||
assert( nArg==1 );
|
||||
|
||||
assert( sqlite3VdbeAssertAggContext(pCtx) );
|
||||
p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
if( p ){
|
||||
if( ALWAYS(p) ){
|
||||
if( p->nTotal==0 ){
|
||||
p->nTotal = sqlite3_value_int64(apArg[0]);
|
||||
}
|
||||
@ -328,8 +345,9 @@ static void ntileStepFunc(
|
||||
){
|
||||
struct NtileCtx *p;
|
||||
assert( nArg==2 );
|
||||
assert( sqlite3VdbeAssertAggContext(pCtx) );
|
||||
p = (struct NtileCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
if( p ){
|
||||
if( ALWAYS(p) ){
|
||||
if( p->nTotal==0 ){
|
||||
p->nParam = sqlite3_value_int64(apArg[0]);
|
||||
p->nTotal = sqlite3_value_int64(apArg[1]);
|
||||
@ -388,7 +406,7 @@ static void last_valueStepFunc(
|
||||
sqlite3_value **apArg
|
||||
){
|
||||
struct LastValueCtx *p;
|
||||
p = (struct LastValueCtx *)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
if( p ){
|
||||
sqlite3_value_free(p->pVal);
|
||||
p->pVal = sqlite3_value_dup(apArg[0]);
|
||||
@ -405,8 +423,8 @@ static void last_valueInvFunc(
|
||||
sqlite3_value **apArg
|
||||
){
|
||||
struct LastValueCtx *p;
|
||||
p = (struct LastValueCtx *)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
if( p ){
|
||||
p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
if( ALWAYS(p) ){
|
||||
p->nVal--;
|
||||
if( p->nVal==0 ){
|
||||
sqlite3_value_free(p->pVal);
|
||||
@ -416,14 +434,14 @@ static void last_valueInvFunc(
|
||||
}
|
||||
static void last_valueValueFunc(sqlite3_context *pCtx){
|
||||
struct LastValueCtx *p;
|
||||
p = (struct LastValueCtx *)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
if( p && p->pVal ){
|
||||
sqlite3_result_value(pCtx, p->pVal);
|
||||
}
|
||||
}
|
||||
static void last_valueFinalizeFunc(sqlite3_context *pCtx){
|
||||
struct LastValueCtx *p;
|
||||
p = (struct LastValueCtx *)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p));
|
||||
if( p && p->pVal ){
|
||||
sqlite3_result_value(pCtx, p->pVal);
|
||||
sqlite3_value_free(p->pVal);
|
||||
@ -737,6 +755,18 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){
|
||||
sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
|
||||
}
|
||||
|
||||
/* If there is no ORDER BY or PARTITION BY clause, and the window
|
||||
** function accepts zero arguments, and there are no other columns
|
||||
** selected (e.g. "SELECT row_number() OVER () FROM t1"), it is possible
|
||||
** that pSublist is still NULL here. Add a constant expression here to
|
||||
** keep everything legal in this case.
|
||||
*/
|
||||
if( pSublist==0 ){
|
||||
pSublist = sqlite3ExprListAppend(pParse, 0,
|
||||
sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0)
|
||||
);
|
||||
}
|
||||
|
||||
pSub = sqlite3SelectNew(
|
||||
pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
|
||||
);
|
||||
|
@ -82,6 +82,9 @@ foreach {tn window} {
|
||||
execsql_test 1.$tn.3.2 "
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a $window ) FROM t2
|
||||
"
|
||||
execsql_test 1.$tn.3.3 "
|
||||
SELECT row_number() OVER ( $window ) FROM t2
|
||||
"
|
||||
|
||||
execsql_test 1.$tn.4.1 "
|
||||
SELECT dense_rank() OVER ( ORDER BY a $window ) FROM t2
|
||||
@ -185,6 +188,9 @@ foreach {tn window} {
|
||||
execsql_float_test 1.$tn.8.6 "
|
||||
SELECT ntile(105) OVER (PARTITION BY b%2,a ORDER BY b%10 $window) FROM t2
|
||||
"
|
||||
execsql_float_test 1.$tn.8.7 "
|
||||
SELECT ntile(105) OVER ( $window ) FROM t2
|
||||
"
|
||||
|
||||
execsql_test 1.$tn.9.1 "
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a $window ) FROM t2
|
||||
|
@ -73,6 +73,10 @@ do_execsql_test 1.1.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.1.3.3 {
|
||||
SELECT row_number() OVER ( RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.1.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -273,6 +277,14 @@ do_test 1.1.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.1.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.1.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207}
|
||||
@ -453,6 +465,10 @@ do_execsql_test 1.2.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.2.3.3 {
|
||||
SELECT row_number() OVER ( RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.2.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -653,6 +669,14 @@ do_test 1.2.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.2.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.2.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207}
|
||||
@ -833,6 +857,10 @@ do_execsql_test 1.3.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.3.3.3 {
|
||||
SELECT row_number() OVER ( RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.3.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -1033,6 +1061,14 @@ do_test 1.3.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.3.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.3.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
|
||||
} {1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207}
|
||||
@ -1213,6 +1249,10 @@ do_execsql_test 1.4.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.4.3.3 {
|
||||
SELECT row_number() OVER ( RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.4.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -1413,6 +1453,14 @@ do_test 1.4.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.4.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.4.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207}
|
||||
@ -1593,6 +1641,10 @@ do_execsql_test 1.5.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.5.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.5.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -1793,6 +1845,14 @@ do_test 1.5.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.5.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.5.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 PRECEDING ) FROM t2
|
||||
} {{} {} {} {} 1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279}
|
||||
@ -1973,6 +2033,10 @@ do_execsql_test 1.6.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.6.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.6.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -2173,6 +2237,14 @@ do_test 1.6.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.6.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.6.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 PRECEDING ) FROM t2
|
||||
} {{} {} 1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280}
|
||||
@ -2353,6 +2425,10 @@ do_execsql_test 1.7.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.7.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.7.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -2553,6 +2629,14 @@ do_test 1.7.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.7.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.7.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207}
|
||||
@ -2733,6 +2817,10 @@ do_execsql_test 1.8.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.8.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.8.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -2933,6 +3021,14 @@ do_test 1.8.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.8.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.8.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND CURRENT ROW ) FROM t2
|
||||
} {1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207}
|
||||
@ -3113,6 +3209,10 @@ do_execsql_test 1.9.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.9.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.9.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -3313,6 +3413,14 @@ do_test 1.9.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.9.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.9.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND CURRENT ROW ) FROM t2
|
||||
} {1 76 44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207}
|
||||
@ -3493,6 +3601,10 @@ do_execsql_test 1.10.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.10.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.10.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -3693,6 +3805,14 @@ do_test 1.10.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.10.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.10.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND 4 FOLLOWING ) FROM t2
|
||||
} {28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207 207 207 207 207}
|
||||
@ -3873,6 +3993,10 @@ do_execsql_test 1.11.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.11.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.11.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -4073,6 +4197,14 @@ do_test 1.11.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.11.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.11.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND 2 FOLLOWING ) FROM t2
|
||||
} {44 78 28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207 207 207}
|
||||
@ -4253,6 +4385,10 @@ do_execsql_test 1.12.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.12.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.12.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -4453,6 +4589,14 @@ do_test 1.12.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.12.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.12.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND 4 FOLLOWING ) FROM t2
|
||||
} {28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207 207 207 207 207}
|
||||
@ -4633,6 +4777,10 @@ do_execsql_test 1.13.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.13.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.13.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -4833,6 +4981,14 @@ do_test 1.13.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.13.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.13.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 2 FOLLOWING AND 4 FOLLOWING ) FROM t2
|
||||
} {28 105 33 41 11 99 92 108 72 52 83 55 79 109 65 26 120 119 50 70 103 80 124 36 96 59 124 116 110 57 51 52 130 103 74 87 48 128 117 105 136 131 71 133 92 109 63 84 109 57 146 78 147 113 74 88 150 87 110 65 121 106 110 124 85 145 107 161 171 150 156 80 171 120 109 158 114 111 136 147 87 173 124 168 173 162 132 101 154 167 190 161 110 156 195 198 102 123 177 169 140 111 180 119 160 197 152 124 121 134 146 147 132 213 141 193 200 210 157 132 136 175 161 218 188 226 191 187 208 211 179 138 144 223 196 214 170 212 202 163 184 172 173 195 229 240 187 210 200 163 227 228 223 191 252 235 225 243 172 187 202 179 179 182 231 261 207 263 206 189 209 212 276 181 274 249 239 234 213 234 269 196 271 221 210 229 235 250 223 232 229 279 224 280 216 207 207 207 {} {}}
|
||||
@ -5013,6 +5169,10 @@ do_execsql_test 1.14.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.14.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.14.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -5213,6 +5373,14 @@ do_test 1.14.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.14.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.14.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207}
|
||||
@ -5393,6 +5561,10 @@ do_execsql_test 1.15.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.15.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.15.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -5593,6 +5765,14 @@ do_test 1.15.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.15.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.15.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 4 PRECEDING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207}
|
||||
@ -5773,6 +5953,10 @@ do_execsql_test 1.16.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.16.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.16.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -5973,6 +6157,14 @@ do_test 1.16.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.16.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.16.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207}
|
||||
@ -6153,6 +6345,10 @@ do_execsql_test 1.17.3.2 {
|
||||
SELECT row_number() OVER ( PARTITION BY b%10 ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23}
|
||||
|
||||
do_execsql_test 1.17.3.3 {
|
||||
SELECT row_number() OVER ( ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
|
||||
do_execsql_test 1.17.4.1 {
|
||||
SELECT dense_rank() OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200}
|
||||
@ -6353,6 +6549,14 @@ do_test 1.17.8.6 {
|
||||
set myres
|
||||
} {1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00}
|
||||
|
||||
do_test 1.17.8.6 {
|
||||
set myres {}
|
||||
foreach r [db eval {SELECT ntile(105) OVER ( ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2}] {
|
||||
lappend myres [format %.2f [set r]]
|
||||
}
|
||||
set myres
|
||||
} {1.00 1.00 2.00 2.00 3.00 3.00 4.00 4.00 5.00 5.00 6.00 6.00 7.00 7.00 8.00 8.00 9.00 9.00 10.00 10.00 11.00 11.00 12.00 12.00 13.00 13.00 14.00 14.00 15.00 15.00 16.00 16.00 17.00 17.00 18.00 18.00 19.00 19.00 20.00 20.00 21.00 21.00 22.00 22.00 23.00 23.00 24.00 24.00 25.00 25.00 26.00 26.00 27.00 27.00 28.00 28.00 29.00 29.00 30.00 30.00 31.00 31.00 32.00 32.00 33.00 33.00 34.00 34.00 35.00 35.00 36.00 36.00 37.00 37.00 38.00 38.00 39.00 39.00 40.00 40.00 41.00 41.00 42.00 42.00 43.00 43.00 44.00 44.00 45.00 45.00 46.00 46.00 47.00 47.00 48.00 48.00 49.00 49.00 50.00 50.00 51.00 51.00 52.00 52.00 53.00 53.00 54.00 54.00 55.00 55.00 56.00 56.00 57.00 57.00 58.00 58.00 59.00 59.00 60.00 60.00 61.00 61.00 62.00 62.00 63.00 63.00 64.00 64.00 65.00 65.00 66.00 66.00 67.00 67.00 68.00 68.00 69.00 69.00 70.00 70.00 71.00 71.00 72.00 72.00 73.00 73.00 74.00 74.00 75.00 75.00 76.00 76.00 77.00 77.00 78.00 78.00 79.00 79.00 80.00 80.00 81.00 81.00 82.00 82.00 83.00 83.00 84.00 84.00 85.00 85.00 86.00 86.00 87.00 87.00 88.00 88.00 89.00 89.00 90.00 90.00 91.00 91.00 92.00 92.00 93.00 93.00 94.00 94.00 95.00 95.00 96.00 97.00 98.00 99.00 100.00 101.00 102.00 103.00 104.00 105.00}
|
||||
|
||||
do_execsql_test 1.17.9.1 {
|
||||
SELECT last_value(a+b) OVER ( ORDER BY a ROWS BETWEEN 4 FOLLOWING AND UNBOUNDED FOLLOWING ) FROM t2
|
||||
} {207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 {} {} {} {}}
|
||||
|
@ -46,7 +46,34 @@ do_faultsim_test 1 -start 1 -faults oom-* -prep {
|
||||
faultsim_test_result {0 {1 1 1 1 4 4 {} 8 {} 4 4 2 2 2 1 4 8 8 12 4 8 4 3 3 3 2 4 12 8 {} 8 12 4}}
|
||||
}
|
||||
|
||||
do_faultsim_test 2 -faults oom-* -prep {
|
||||
do_faultsim_test 1.1 -faults oom-t* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
} -body {
|
||||
execsql {
|
||||
SELECT row_number() OVER win,
|
||||
rank() OVER win,
|
||||
dense_rank() OVER win
|
||||
FROM t1
|
||||
WINDOW win AS (PARTITION BY c<7 ORDER BY a)
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 {1 1 1 2 2 2 1 1 1}}
|
||||
}
|
||||
|
||||
do_faultsim_test 2 -start 1 -faults oom-* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
} -body {
|
||||
execsql {
|
||||
SELECT round(percent_rank() OVER win, 2),
|
||||
round(cume_dist() OVER win, 2)
|
||||
FROM t1
|
||||
WINDOW win AS (ORDER BY a)
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 {0.0 0.33 0.5 0.67 1.0 1.0}}
|
||||
}
|
||||
|
||||
do_faultsim_test 3 -faults oom-* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
} -body {
|
||||
execsql {
|
||||
@ -58,6 +85,33 @@ do_faultsim_test 2 -faults oom-* -prep {
|
||||
faultsim_test_result {0 {4 12 8 12 12 12}}
|
||||
}
|
||||
|
||||
do_faultsim_test 4 -faults oom-* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
} -body {
|
||||
execsql {
|
||||
CREATE VIEW aaa AS
|
||||
SELECT min(d) OVER w, max(d) OVER w
|
||||
FROM t1
|
||||
WINDOW w AS (ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING);
|
||||
SELECT * FROM aaa;
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 {4 12 8 12 12 12}}
|
||||
}
|
||||
|
||||
do_faultsim_test 5 -start 1 -faults oom-* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
} -body {
|
||||
execsql {
|
||||
SELECT last_value(a) OVER win1,
|
||||
last_value(a) OVER win2
|
||||
FROM t1
|
||||
WINDOW win1 AS (ORDER BY a ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING),
|
||||
win2 AS (ORDER BY a)
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 {5 1 9 5 9 9}}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user