Commit Graph

25 Commits

Author SHA1 Message Date
dan
553948e514 Fix handling of window functions in aggregate queries that have no GROUP BY clause. Also remove a faulty assert causing the error reported in [618156e3].
FossilOrigin-Name: 38e3dd389d142e520c71139ec84aa3c7722992af28a5f93a7f16e0ea176b74bb
2020-03-16 18:52:53 +00:00
dan
b6299681c6 Add extra test cases related to the previous commit.
FossilOrigin-Name: 3c690b2b05b7338f3325c50a0750c6023e1173afa4388e836ecb2cc49f19a0ac
2019-08-10 14:35:06 +00:00
dan
108e6b2c87 Always evaluate window functions using the alternative path usually only used by EXCLUDE frames if the SQLITE_QueryFlattener test flag is set.
FossilOrigin-Name: 2879a691aca9304aea5acb46bab8e82bb2e08eb54201f3679d60bfc0e8383845
2019-03-18 18:55:35 +00:00
dan
6c75b39614 Finish consolidation of window frame code. Add untested support for GROUPS frames.
FossilOrigin-Name: 954bf369935083c188c3b14e77ed89fc5ec4323cc5b0c67e4a2e48fcc278df45
2019-03-08 20:02:52 +00:00
dan
2fae150402 Fix a problem with views that use window functions as part of complex expressions.
FossilOrigin-Name: 507d892c3a40a0bacbd47ed3c4fe2d8925a82716ae08da8401750a42782ba454
2018-09-24 14:51:59 +00:00
dan
a1a7e112fe Throw an error if the second argument passed to nth_value() is not a positive
integer.

FossilOrigin-Name: 1a06e57a0b4279fa580c7ff4f152645f005794aaf86eeabf694637b7da11f763
2018-07-09 13:31:18 +00:00
dan
d4fc49f735 Fix a problem with the handling of NULL values in the min() window function.
FossilOrigin-Name: b76f35b09235d44dc3d176377bbb9c18b7cdc9392800103ff53c54730a427a5c
2018-07-07 17:30:44 +00:00
dan
cf0343b699 Remove some bad assert() statements from the implementations of window
functions percent_rank() and cume_dist().

FossilOrigin-Name: 443f0c286f1659937fd61b4ef2de17d0d015369e5ff5249a9e0c3d0ee4925158
2018-07-06 13:25:02 +00:00
dan
867be212bc Fix another problem that could cause a crash when a window function was used
in a view.

FossilOrigin-Name: e954145a3addf60247954b9161473cd02ae2400f469840523093e25e23fbc54d
2018-06-25 11:42:08 +00:00
dan
67a9b8eded Omit all window-function related code when building with SQLITE_OMIT_WINDOWFUNC.
FossilOrigin-Name: 5f04b016467342b5a796bf702ed25b621eb86f2961c1e703d276c93f2cb6aa89
2018-06-22 20:51:35 +00:00
dan
b7306f6f6e Fix a problem with handling single row partitions in the percent_rank() window
function.

FossilOrigin-Name: b84fbf16eac718c151731e2b2dcc73f2f2a144e3670f8566a30793f1e4e6a3ec
2018-06-21 19:20:39 +00:00
dan
6fde1799f8 Fix another problem in lead()/lag(). And some errors that could occur
following OOM faults.

FossilOrigin-Name: fadd4dc119d8df0d871f4d839b7a11070e2ffb8927e84b3e7a94f34196db3de3
2018-06-15 19:01:35 +00:00
dan
e0a5e20fa8 Fix a bug in the lead() and lag() window functions causing them to fail when
used in queries featuring multiple window functions.

FossilOrigin-Name: 3839fb18f917e4f705821198d624b19d84eb07f1ee29ad23314ab7cec6bf6a2b
2018-06-15 16:10:44 +00:00
dan
303451a8f7 Fix a problem with handling of statements containing two or more different
windows.

FossilOrigin-Name: 567e09ef2a8cd84a2481117e52595bed0f3b588745a9e441aae0f87680f3a2e8
2018-06-14 20:52:08 +00:00
dan
9a94722d48 Fix problem with window functions min() and max() when used with a PARTITION
clause and a frame starting point other than "UNBOUNDED PRECEDING".

FossilOrigin-Name: 43eb1e75a4d7ac0973ed8589bbaf379c24cdc8eacc4e613610d2d4c24d385dc1
2018-06-14 19:06:36 +00:00
dan
13078caac4 Fix problems with "RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING" window
frames.

FossilOrigin-Name: c34f31dbd79891249ee9485e91f6ea558ee1db62e04fb0fff2c051612b8fa5e7
2018-06-13 20:29:38 +00:00
dan
c0bb4459d3 Fix another issue to do with window-functions in aggregate queries.
FossilOrigin-Name: 6413e38a174044c28fa9b8b937e6c972d144547a246e6f2882e782538300d042
2018-06-12 20:53:38 +00:00
dan
7392569f5e Fix some problems with using window-functions in aggregate queries.
FossilOrigin-Name: fe7081e0952950f577234fcbb58f3c1efa4579267654fd2f713dc4804e470e7e
2018-06-12 18:40:17 +00:00
dan
26522d1c45 Fix handling of window frames containing negative number of rows. e.g. "ROWS x
PRECEDING AND y PRECEDING" where (x<y).

FossilOrigin-Name: b6d9c7eda853420ae46a05bd432711e8bf9ebaa448c7d90ccfc0bcc338a87706
2018-06-11 18:16:51 +00:00
dan
8b98560d6e Add support for FILTER clause on aggregate window functions.
FossilOrigin-Name: ceaf798ea09184bc0e7d3dcf3ad4d909d2e4e7018754a8417a813f33010140a7
2018-06-09 17:43:45 +00:00
dan
e3bf632cc2 Add support for the WINDOW clause.
FossilOrigin-Name: 19c983b511f1c823fdfb051713681b4c779f02fa83b41189afca0a9b8b72048d
2018-06-08 20:58:27 +00:00
dan
03854d2ecc Fixes to allow group_concat() to be used as a window function.
FossilOrigin-Name: 89bbc9ba8f66853a7530453f146c9df1baacd8558468016cefa7602911f7578a
2018-06-08 11:45:28 +00:00
dan
fe4e25a0f6 Add window functions lag() and lead().
FossilOrigin-Name: ef34207073c21ce8618486777671ae78d23f290acd6d3c37e91a49b69cb506ac
2018-06-07 20:08:59 +00:00
dan
ec891fd40c Add implementation of nth_value() window function.
FossilOrigin-Name: eb1fb420ac70857e7ca4cbad78be15a27bee8f915ba2da080c7efa1879c06c31
2018-06-06 20:51:02 +00:00
dan
6bc5c9e788 Add implementation of window function ntile().
FossilOrigin-Name: 3f093f608c6cc193aac77e7eafa8006c27a7776682d9d7b6e743710dff41ae42
2018-06-04 18:55:11 +00:00