New test cases for window functions with RANGE BETWEEN and DESC NULLS FIRST.
FossilOrigin-Name: f7002f86c780e279c9f8a6268f317586519c059c9de2115ff6f1cad272570c29
This commit is contained in:
parent
8b47f52082
commit
ac6627327c
13
manifest
13
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sa\sbug\sin\sRANGE\swindow\sfunctions\sthat\suse\s"ORDER\sBY\s<expr>\sDESC\sNULLS\sFIRST"\sas\sthe\swindow-frame\sORDER\sBY\sclause.
|
||||
D 2019-08-30T16:14:58.448
|
||||
C New\stest\scases\sfor\swindow\sfunctions\swith\sRANGE\sBETWEEN\sand\sDESC\sNULLS\sFIRST.
|
||||
D 2019-08-30T16:46:12.848
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -1714,6 +1714,7 @@ F test/window7.test 1d31276961ae7801edc72173edaf7593e3cbc79c06d1f1f09e20d8418af4
|
||||
F test/window8.tcl 3b63931d608b6f00a9d26368207a7ffc9370c96e3e137ae2aff35284ade69d13
|
||||
F test/window8.test 4531204bfb5d833efbd8a5a1527c9871e62f8ae479386f42a7b55bdb5be39df3
|
||||
F test/window9.test 20a6b590be718b6bc98a5356d4396d6cdf19329c547da084fa225b92d68e1693
|
||||
F test/windowA.test 5cd7c8dc3b2fcdfc6ea122c81a35726106880ae75afd097f62061839aff13b71
|
||||
F test/windowerr.tcl f5acd6fbc210d7b5546c0e879d157888455cd4a17a1d3f28f07c1c8a387019e0
|
||||
F test/windowerr.test a8b752402109c15aa1c5efe1b93ccb0ce1ef84fa964ae1cd6684dd0b3cc1819b
|
||||
F test/windowfault.test a90b397837209f15e54afa62e8be39b2759a0101fae04e05a08bcc50e243a452
|
||||
@ -1837,7 +1838,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 dd66134817ecbda01c59a05ad0d6ac44bee700ab10cd2119c869dd69af293fe2
|
||||
R f9d7b459685c1da5bc61b772c0f2da65
|
||||
U dan
|
||||
Z 05bbd4877d54c35c485e8a33829586c4
|
||||
P 39b4cad4a51bb5116d62ffb16ac36d96a9280321b049eb2d008605392f52a459
|
||||
R 5b7566c6e8c614d220a50ba45c732f15
|
||||
U drh
|
||||
Z 7f59914616f53a7b55c42685c9ae4ee5
|
||||
|
@ -1 +1 @@
|
||||
39b4cad4a51bb5116d62ffb16ac36d96a9280321b049eb2d008605392f52a459
|
||||
f7002f86c780e279c9f8a6268f317586519c059c9de2115ff6f1cad272570c29
|
292
test/windowA.test
Normal file
292
test/windowA.test
Normal file
@ -0,0 +1,292 @@
|
||||
# 2019-08-30
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# Test cases for RANGE BETWEEN and especially with NULLS LAST
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix windowA
|
||||
|
||||
ifcapable !windowfunc {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b CHAR(1), d FLOAT);
|
||||
INSERT INTO t1 VALUES
|
||||
(1, 'A', 5.4),
|
||||
(2, 'B', 5.55),
|
||||
(3, 'C', 8.0),
|
||||
(4, 'D', 10.25),
|
||||
(5, 'E', 10.26),
|
||||
(6, 'N', NULL),
|
||||
(7, 'N', NULL);
|
||||
} {}
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS LAST
|
||||
RANGE BETWEEN 2.50 PRECEDING AND 2.25 FOLLOWING)
|
||||
ORDER BY +d DESC NULLS LAST, +a;
|
||||
} [list \
|
||||
5 E 10.26 ED \
|
||||
4 D 10.25 EDC \
|
||||
3 C 8.0 EDC \
|
||||
2 B 5.55 CBA \
|
||||
1 A 5.4 BA \
|
||||
6 N NULL NN \
|
||||
7 N NULL NN \
|
||||
]
|
||||
|
||||
do_execsql_test 1.2 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS FIRST
|
||||
RANGE BETWEEN 2.50 PRECEDING AND 2.25 FOLLOWING)
|
||||
ORDER BY +d DESC NULLS FIRST, +a;
|
||||
} [list \
|
||||
6 N NULL NN \
|
||||
7 N NULL NN \
|
||||
5 E 10.26 ED \
|
||||
4 D 10.25 EDC \
|
||||
3 C 8.0 EDC \
|
||||
2 B 5.55 CBA \
|
||||
1 A 5.4 BA \
|
||||
]
|
||||
|
||||
do_execsql_test 1.3 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS LAST
|
||||
RANGE BETWEEN 2.50 PRECEDING AND UNBOUNDED FOLLOWING)
|
||||
ORDER BY +d DESC NULLS LAST, +a;
|
||||
} [list \
|
||||
5 E 10.26 EDCBANN \
|
||||
4 D 10.25 EDCBANN \
|
||||
3 C 8.0 EDCBANN \
|
||||
2 B 5.55 CBANN \
|
||||
1 A 5.4 BANN \
|
||||
6 N NULL NN \
|
||||
7 N NULL NN \
|
||||
]
|
||||
|
||||
do_execsql_test 1.4 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS FIRST
|
||||
RANGE BETWEEN 2.50 PRECEDING AND UNBOUNDED FOLLOWING)
|
||||
ORDER BY +d DESC NULLS FIRST, +a;
|
||||
} [list \
|
||||
6 N NULL NNEDCBA \
|
||||
7 N NULL NNEDCBA \
|
||||
5 E 10.26 EDCBA \
|
||||
4 D 10.25 EDCBA \
|
||||
3 C 8.0 EDCBA \
|
||||
2 B 5.55 CBA \
|
||||
1 A 5.4 BA \
|
||||
]
|
||||
|
||||
do_execsql_test 1.5 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS LAST
|
||||
RANGE BETWEEN 2.50 PRECEDING AND CURRENT ROW)
|
||||
ORDER BY +d DESC NULLS LAST, +a;
|
||||
} [list \
|
||||
5 E 10.26 E \
|
||||
4 D 10.25 ED \
|
||||
3 C 8.0 EDC \
|
||||
2 B 5.55 CB \
|
||||
1 A 5.4 BA \
|
||||
6 N NULL NN \
|
||||
7 N NULL NN \
|
||||
]
|
||||
|
||||
do_execsql_test 1.6 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS FIRST
|
||||
RANGE BETWEEN 2.50 PRECEDING AND CURRENT ROW)
|
||||
ORDER BY +d DESC NULLS FIRST, +a;
|
||||
} [list \
|
||||
6 N NULL NN \
|
||||
7 N NULL NN \
|
||||
5 E 10.26 E \
|
||||
4 D 10.25 ED \
|
||||
3 C 8.0 EDC \
|
||||
2 B 5.55 CB \
|
||||
1 A 5.4 BA \
|
||||
]
|
||||
|
||||
do_execsql_test 2.1 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS LAST
|
||||
RANGE BETWEEN UNBOUNDED PRECEDING AND 2.25 FOLLOWING)
|
||||
ORDER BY +d DESC NULLS LAST, +a;
|
||||
} [list \
|
||||
5 E 10.26 ED \
|
||||
4 D 10.25 EDC \
|
||||
3 C 8.0 EDC \
|
||||
2 B 5.55 EDCBA \
|
||||
1 A 5.4 EDCBA \
|
||||
6 N NULL EDCBANN \
|
||||
7 N NULL EDCBANN \
|
||||
]
|
||||
|
||||
do_execsql_test 2.2 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS FIRST
|
||||
RANGE BETWEEN UNBOUNDED PRECEDING AND 2.25 FOLLOWING)
|
||||
ORDER BY +d DESC NULLS FIRST, +a;
|
||||
} [list \
|
||||
6 N NULL NN \
|
||||
7 N NULL NN \
|
||||
5 E 10.26 NNED \
|
||||
4 D 10.25 NNEDC \
|
||||
3 C 8.0 NNEDC \
|
||||
2 B 5.55 NNEDCBA \
|
||||
1 A 5.4 NNEDCBA \
|
||||
]
|
||||
|
||||
do_execsql_test 2.3 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS LAST
|
||||
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
|
||||
ORDER BY +d DESC NULLS LAST, +a;
|
||||
} [list \
|
||||
5 E 10.26 EDCBANN \
|
||||
4 D 10.25 EDCBANN \
|
||||
3 C 8.0 EDCBANN \
|
||||
2 B 5.55 EDCBANN \
|
||||
1 A 5.4 EDCBANN \
|
||||
6 N NULL EDCBANN \
|
||||
7 N NULL EDCBANN \
|
||||
]
|
||||
|
||||
do_execsql_test 2.4 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS FIRST
|
||||
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
|
||||
ORDER BY +d DESC NULLS FIRST, +a;
|
||||
} [list \
|
||||
6 N NULL NNEDCBA \
|
||||
7 N NULL NNEDCBA \
|
||||
5 E 10.26 NNEDCBA \
|
||||
4 D 10.25 NNEDCBA \
|
||||
3 C 8.0 NNEDCBA \
|
||||
2 B 5.55 NNEDCBA \
|
||||
1 A 5.4 NNEDCBA \
|
||||
]
|
||||
|
||||
do_execsql_test 2.5 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS LAST
|
||||
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
|
||||
ORDER BY +d DESC NULLS LAST, +a;
|
||||
} [list \
|
||||
5 E 10.26 E \
|
||||
4 D 10.25 ED \
|
||||
3 C 8.0 EDC \
|
||||
2 B 5.55 EDCB \
|
||||
1 A 5.4 EDCBA \
|
||||
6 N NULL EDCBANN \
|
||||
7 N NULL EDCBANN \
|
||||
]
|
||||
|
||||
do_execsql_test 2.6 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS FIRST
|
||||
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
|
||||
ORDER BY +d DESC NULLS FIRST, +a;
|
||||
} [list \
|
||||
6 N NULL NN \
|
||||
7 N NULL NN \
|
||||
5 E 10.26 NNE \
|
||||
4 D 10.25 NNED \
|
||||
3 C 8.0 NNEDC \
|
||||
2 B 5.55 NNEDCB \
|
||||
1 A 5.4 NNEDCBA \
|
||||
]
|
||||
|
||||
|
||||
do_execsql_test 3.1 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS LAST
|
||||
RANGE BETWEEN CURRENT ROW AND 2.25 FOLLOWING)
|
||||
ORDER BY +d DESC NULLS LAST, +a;
|
||||
} [list \
|
||||
5 E 10.26 ED \
|
||||
4 D 10.25 DC \
|
||||
3 C 8.0 C \
|
||||
2 B 5.55 BA \
|
||||
1 A 5.4 A \
|
||||
6 N NULL NN \
|
||||
7 N NULL NN \
|
||||
]
|
||||
|
||||
do_execsql_test 3.2 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS FIRST
|
||||
RANGE BETWEEN CURRENT ROW AND 2.25 FOLLOWING)
|
||||
ORDER BY +d DESC NULLS FIRST, +a;
|
||||
} [list \
|
||||
6 N NULL NN \
|
||||
7 N NULL NN \
|
||||
5 E 10.26 ED \
|
||||
4 D 10.25 DC \
|
||||
3 C 8.0 C \
|
||||
2 B 5.55 BA \
|
||||
1 A 5.4 A \
|
||||
]
|
||||
|
||||
do_execsql_test 3.3 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS LAST
|
||||
RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
|
||||
ORDER BY +d DESC NULLS LAST, +a;
|
||||
} [list \
|
||||
5 E 10.26 EDCBANN \
|
||||
4 D 10.25 DCBANN \
|
||||
3 C 8.0 CBANN \
|
||||
2 B 5.55 BANN \
|
||||
1 A 5.4 ANN \
|
||||
6 N NULL NN \
|
||||
7 N NULL NN \
|
||||
]
|
||||
|
||||
do_execsql_test 3.4 {
|
||||
SELECT a, b, quote(d), group_concat(b,'') OVER w1 FROM t1
|
||||
WINDOW w1 AS
|
||||
(ORDER BY d DESC NULLS FIRST
|
||||
RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
|
||||
ORDER BY +d DESC NULLS FIRST, +a;
|
||||
} [list \
|
||||
6 N NULL NNEDCBA \
|
||||
7 N NULL NNEDCBA \
|
||||
5 E 10.26 EDCBA \
|
||||
4 D 10.25 DCBA \
|
||||
3 C 8.0 CBA \
|
||||
2 B 5.55 BA \
|
||||
1 A 5.4 A \
|
||||
]
|
||||
|
||||
finish_test
|
Loading…
Reference in New Issue
Block a user