/ File History
Login

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

History of src/window.c

2019-07-16
19:44
Add new assert() statements in an attempt to help static analyzers avoid false-positives. file: [e0b821aa] check-in: [9e664585] user: drh branch: trunk, size: 91606
2019-07-13
16:22
Rework the FILTER clause implementation to share more code with window functions. file: [6cfb1b3c] check-in: [5dac8c38] user: dan branch: filter-clause, size: 91514
09:56
Merge latest trunk changes into this branch. file: [1d78310e] check-in: [86ab963c] user: dan branch: filter-clause, size: 91562
2019-07-08
12:01
Ensure collation sequences and affinities work in window function queries. Fix for [9ece23d2]. file: [3408c0f6] check-in: [28196d89] user: dan branch: trunk, size: 91559
2019-07-02
11:56
Experimental implementation of FILTER clause for aggregate functions. file: [c595e250] check-in: [1f1ae2d6] user: dan branch: filter-clause, size: 91186
2019-05-10
14:26
Treat integer values in window definition ORDER BY clauses as constants, not as references to another expression. file: [5be2cf7d] check-in: [7e4809ea] user: dan branch: trunk, size: 91183
2019-04-03
16:27
Fix a couple of problems with "RANGE BETWEEN <expr> PRECEDING AND <expr> PRECEDING" frames. file: [038c2482] check-in: [39225cc7] user: dan branch: trunk, size: 91002
2019-04-02
17:45
Use a separate bit on db->dbOptFlags to disable the xInverse optimization on window functions, rather than reusing the query-flattener disable bit. file: [1c3e20fc] check-in: [bc0fb1c3] user: drh branch: trunk, size: 90541
2019-04-01
16:23
Frame range comparisons can never be NULL because the values will have been checked for NULL prior to the test. file: [aefd7e45] check-in: [fa37cf9a] user: drh branch: trunk, size: 90545
15:55
Mark rowid-comparison opcodes as never-null for VDBE coverage tracking purposes. file: [8d840b83] check-in: [a69bb4f2] user: drh branch: trunk, size: 90477
14:30
Improved VDBE branch coverage in the run-time frame-spec error detection logic of window functions. file: [76a3a9be] check-in: [f56d305a] user: drh branch: trunk, size: 90450
2019-03-31
18:17
Add some missing VdbeCoverage() macros. file: [bd1e1c26] check-in: [d03b6113] user: drh branch: trunk, size: 90290
2019-03-30
20:37
Fix issues with the previous check-in and add more VDBE branch coverage testing macros. file: [a63ef839] check-in: [b5f72f10] user: drh branch: oops, size: 90291
20:10
Enhanced VdbeCoverage() macros in the new windows function code. Later: This check-in causes an assertion fault. file: [30cbf5f4] check-in: [f24066f8] user: drh branch: oops, size: 89988
2019-03-28
13:03
Improved TreeView display of Window objects. Change the Window.eType field to Window.eFrmType to avoid confusion with other "eType" values. file: [92b6d593] check-in: [ec2f207d] user: drh branch: trunk, size: 89815
2019-03-27
14:58
Fix harmless compiler warnings seen with MSVC. file: [2e3fdb04] check-in: [5be64ea8] user: mistachkin branch: trunk, size: 89697
2019-03-26
16:47
Fix a problem with window frames that use "BETWEEN <start> AND 0 PRECEDING". file: [adddab66] check-in: [7927b6b0] user: dan branch: trunk, size: 89689
16:21
Fix harmless compiler warnings. file: [ff72295b] check-in: [a063f7c4] user: drh branch: trunk, size: 89215
2019-03-21
13:51
Remove assert() statements based on the counter-factual proposition that 0 is not a valid cursor number. file: [9849eee7] check-in: [c7b33618] user: dan branch: window-functions, size: 89080
2019-03-19
19:19
Fix a problem with EXCLUDE clauses on window frames with no ORDER BY. file: [bcf909b9] check-in: [e0255063] user: dan branch: window-functions, size: 89144
16:49
Add missing VdbeCoverage() macros to new code in window.c. file: [9a860432] check-in: [4f9b93e6] user: dan branch: window-functions, size: 89013
11:56
Revert the OP_MustBeInt opcode implementation on this branch so that it again matches trunk. The extra functionality is no longer required. file: [bd0a1267] check-in: [c02f77b1] user: dan branch: window-functions, size: 88475
2019-03-18
21:19
Add further tests for new window function functionality. file: [76d83479] check-in: [1fbddf01] user: dan branch: window-functions, size: 88243
18:55
Always evaluate window functions using the alternative path usually only used by EXCLUDE frames if the SQLITE_QueryFlattener test flag is set. file: [ff735851] check-in: [2879a691] user: dan branch: window-functions, size: 88230
16:51
Fixes for RANGE windows and NULL values. file: [aa50be1f] check-in: [723c84be] user: dan branch: window-functions, size: 87324
2019-03-16
20:29
Fix problems with RANGE windows and string, blob and NULL values. file: [3c13b17c] check-in: [cebe09e1] user: dan branch: window-functions, size: 87325
10:15
In order to identify the first row of each partition, check if the rowid in the ephemeral table is 1 instead of using a dedicated flag register. file: [58c0e510] check-in: [f2d5f7a2] user: dan branch: window-functions, size: 86734
2019-03-15
20:46
Implement the EXCLUDE clause for window frames. file: [d4124c8a] check-in: [9b43c3ee] user: dan branch: window-functions, size: 86852
2019-03-14
20:53
Parse EXCLUDE clauses in window frames. They do not yet work. file: [5b103f63] check-in: [d03c7533] user: dan branch: window-functions, size: 84727
16:36
Add things to this branch that will be required to support the EXCLUDE clause. file: [8b3081e3] check-in: [7d66cd20] user: dan branch: window-functions, size: 84657
2019-03-13
17:20
Avoid allocating excessive registers for the PARTITION BY expressions when processing window functions. file: [218582db] check-in: [180be266] user: dan branch: window-functions, size: 81274
15:29
Remove rows from the ephemeral table used by window functions once they are no longer required. file: [e05db1c6] check-in: [6ad55319] user: dan branch: window-functions, size: 81443
08:28
Minor optimization in sqlite3WindowCodeStep(). file: [ac687a05] check-in: [b1322ffb] user: dan branch: window-functions, size: 80131
2019-03-12
18:28
Allow real values to be used in PRECEDING and FOLLOWING expressions for RANGE window frames. file: [536bc805] check-in: [25ff7091] user: dan branch: window-functions, size: 79947
15:21
Expand on header comment for sqlite3WindowCodeStep(). Further simplify the implementation of the same. file: [4763c2e8] check-in: [5129bcc9] user: dan branch: window-functions, size: 79538
2019-03-11
19:50
Remove "cache mode" from the window frame code generator. Handle the same cases by editing the window frame specification itself. file: [f41e0b36] check-in: [08126353] user: dan branch: window-functions, size: 74975
18:17
Simplify the windows frame code some. Add a comment explaining some of the VM code generated by sqlite3WindowCodeStep(). file: [ca0d94d2] check-in: [6bd1a079] user: dan branch: window-functions, size: 76436
11:12
Fix problems with "RANGE ... ORDER BY <expr> DESC" window frames. file: [199efb1a] check-in: [e7bced73] user: dan branch: window-functions, size: 71310
2019-03-09
20:49
Add support for RANGE window frames. Some cases still do not work. file: [bbdf43af] check-in: [ffc32b24] user: dan branch: window-functions, size: 71011
2019-03-08
20:02
Finish consolidation of window frame code. Add untested support for GROUPS frames. file: [e2e56938] check-in: [954bf369] user: dan branch: window-functions, size: 67905
2019-03-07
20:47
Fix other "ROWS BETWEEN" cases on this branch. file: [fd7eae2b] check-in: [a5f68f66] user: dan branch: window-functions, size: 81459
19:26
Modify new window functions function so that cursors are stepped immediately after each operation, instead of immediately before. file: [00962a6b] check-in: [093d2b25] user: dan branch: window-functions, size: 90849
2019-03-06
21:04
Simplify the window function code generator some more. file: [06257715] check-in: [45cbd3b4] user: dan branch: window-functions, size: 90377
17:12
Improvements to the way built-in window functions are handled. file: [607664ea] check-in: [e8eee566] user: dan branch: window-functions, size: 89053
2019-03-05
19:29
Extend windowCodeStep() to handle any ROWS PRECEDING/FOLLOWING frame specification. file: [d722f9b0] check-in: [af0ea136] user: dan branch: window-functions, size: 87440
2019-03-04
21:07
Support some "ROWS BETWEEN N PRECEDING AND M FOLLOWING" window functions without caching entire partitions. file: [b2316f60] check-in: [e7a91f12] user: dan branch: window-functions, size: 84209
2019-02-16
17:27
Add support for chaining of WINDOW definitions. file: [a96e58c9] check-in: [c155125f] user: dan branch: window-functions, size: 77750
2019-01-27
02:41
Window functions that can abort should indicate this, so that if they are used in DML statement, a statement journal will be used. file: [df245638] check-in: [0ea05a0e] user: drh branch: trunk, size: 75489
2019-01-26
16:34
Roll back the transaction if a write statement fails with OE_Abort but there is no open statement transaction. file: [c59090ba] check-in: [d536be69] user: dan branch: rollback-abort, size: 75522
2019-01-17
15:40
Revamp the SrcList allocator routines to be methods of Parse instead of being methods of the "sqlite3" object, so that they can leave better error messages when the SrcList object grows too large. file: [1f4f7c69] check-in: [df08d472] user: drh branch: trunk, size: 75462
2019-01-16
12:05
Avoid a dangling pointer comparison when renaming a table that has a trigger that itself contains a window function with an (illegal) column reference in a FOLLOWING expression. file: [5950fb4d] check-in: [d45bee36] user: dan branch: trunk, size: 75501
2018-12-29
02:26
A new implementation of sqlite3VdbeMakeLabel() is faster and makes fewer memory allocations by deferring memory allocation until sqlite3VdbeResolveLabel() is called, at which point the code generator has a better idea of how big the relocation table needs to be. The sqlite3VdbeMakeLabel() routine now takes a Parse* parameter instead of Vdbe*. file: [f4a9ac83] check-in: [4a0929ac] user: drh branch: trunk, size: 75435
2018-12-06
22:04
Fix the sqlite3ExprDup() routine so that it makes complete duplications of subqueries containing window functions. file: [ea81ecd0] check-in: [94017454] user: drh branch: ticket-f09fcd17810f, size: 75400
2018-10-23
13:48
Fix a problem with using window functions in compound (UNION, INTERSECT etc.) queries. file: [6550e285] check-in: [059ff53a] user: dan branch: trunk, size: 75370
2018-09-20
19:02
Combine the Expr.pTab and Expr.pWin fields into a union named "y". Add a new EP_WinFunc property that is only true if Expr.y.pWin is a valid pointer. This reduces the size of the Expr object by 8 bytes, reduces the overall amount of code, and shaves over 1 million cycles off of the speed test. file: [a28d8d42] check-in: [ad130bb8] user: drh branch: trunk, size: 75354
2018-07-27
23:33
Improvements to the parser to increase coverage. Fix the parser so that at least one expresssion is required after PARTITION BY and within the list of expressions on VALUES(). file: [4b503da9] check-in: [02204f8b] user: drh branch: trunk, size: 75249
2018-07-11
03:27
Adjustments to VdbeCoverage macros to deal with byte-code branches that can never be taken in some directions. file: [c61434ce] check-in: [b170c009] user: drh branch: trunk, size: 75070
2018-07-10
23:31
Remove incorrect ALWAYS() macros from the window function logic. file: [59a256d2] check-in: [94ac51cc] user: drh branch: trunk, size: 75033
22:24
Add VdbeModuleComment()s on the three main code generators for window functions. file: [f0ff1319] check-in: [f7c239e9] user: drh branch: trunk, size: 75581
20:50
Minor comment changes. Add ALWAYS() macros on some unreachable branches in the xStep() methods of built-in window functions. file: [ba6d7cf7] check-in: [f2057542] user: drh branch: trunk, size: 75390
17:26
Fix a problem with using scalar sub-selects in window function queries. file: [8d53b617] check-in: [687fe532] user: dan branch: trunk, size: 74780
17:10
Further improvements to bytecode branch testing. Fix cases where the macros said a branch could not be taken when in fact it could be. Alter some window function branch coverage macros to indicate that comparison operands cannot be NULL. file: [74d56384] check-in: [76e42b70] user: drh branch: trunk, size: 73862
05:11
New VDBE comments and coverage macros. file: [df2bc081] check-in: [a9a30726] user: drh branch: trunk, size: 73808
2018-07-09
22:49
Fixes for various harmless compiler warnings. file: [60b37494] check-in: [5023b1b8] user: drh branch: trunk, size: 73466
17:33
Remove redundant branches in window function processing. file: [0d5d4bcd] check-in: [8fdaf3f3] user: drh branch: trunk, size: 72945
13:31
Throw an error if the second argument passed to nth_value() is not a positive integer. file: [a3f2de2f] check-in: [1a06e57a] user: dan branch: trunk, size: 72915
06:51
Fix a bad assert() in window.c. file: [fcc7f6fe] check-in: [fe8aaf0c] user: dan branch: trunk, size: 72648
2018-07-08
01:02
Identify specific FuncDef objects for window functions using the pointer to the function name (FuncDef.zName) rather than the pointer to the xStep method. This allows xStep method pointer to be replaced with a single noopStepFunc() procedure, and thus save having lots of different no-op step functions. file: [e42415fb] check-in: [410e13b0] user: drh branch: trunk, size: 72559
2018-07-07
17:38
Add missing VdbeCoverage() macro to window.c. file: [0ff90007] check-in: [63f4d306] user: dan branch: trunk, size: 71946
17:30
Fix a problem with the handling of NULL values in the min() window function. file: [635b5bea] check-in: [b76f35b0] user: dan branch: trunk, size: 71927
2018-07-06
17:19
Try to improve the error messages for misformed frame specifications in window definitions. file: [0e127e91] check-in: [927b95a0] user: drh branch: trunk, size: 71798
14:31
Also disallow non-constant expressions in "<expr> PRECEDING" or "<expr> FOLLOWING" clauses. file: [b681846a] check-in: [a6dffecc] user: dan branch: trunk, size: 70320
14:15
Ensure an error is returned if the user specifies an unsupported frame type. file: [8f977b35] check-in: [0f3f8fcd] user: dan branch: trunk, size: 70214
13:25
Remove some bad assert() statements from the implementations of window functions percent_rank() and cume_dist(). file: [5bb6f305] check-in: [443f0c28] user: dan branch: trunk, size: 69591
07:42
Return an error if DISTINCT is used with a window-function (e.g. "count(DISTINCT <expr>) OVER (...)"). file: [6f58bfcd] check-in: [d59bcc8e] user: dan branch: trunk, size: 69701
2018-07-05
21:22
Use separate opcodes, OP_AggValue and OP_AggInverse, for the new callbacks associated with Window Functions, for improved readability of EXPLAIN output. file: [51827401] check-in: [fa653805] user: drh branch: trunk, size: 69560
18:34
Return an error if a "RANGE" window-frame uses "<expr> PRECEDING" or "<expr> FOLLOWING". file: [00df6e1b] check-in: [786c87ba] user: dan branch: trunk, size: 69506
2018-07-02
12:07
Fix a segfault caused by invoking a regular aggregate as a window-function. And some problems with count(*) when used as a window-function. file: [7df0313f] check-in: [4f3c8a82] user: dan branch: trunk, size: 69308
2018-06-27
20:24
Add missing VdbeCoverage() and VdbeCoverageNeverTaken() macros to window.c. file: [4403ae36] check-in: [4383cb68] user: dan branch: exp-window-functions, size: 69097
19:48
Avoid redundant ORDER BY operations when rewriting SELECT statements that contain window functions. file: [14c64e07] check-in: [336de43a] user: dan branch: exp-window-functions, size: 68305
2018-06-22
20:51
Omit all window-function related code when building with SQLITE_OMIT_WINDOWFUNC. file: [b4442598] check-in: [5f04b016] user: dan branch: exp-window-functions, size: 67946
17:57
Merge latest trunk changes. file: [b4a22460] check-in: [ebe65b23] user: dan branch: exp-window-functions, size: 67878
2018-06-21
19:20
Fix a problem with handling single row partitions in the percent_rank() window function. file: [358312db] check-in: [b84fbf16] user: dan branch: exp-window-functions, size: 67933
2018-06-20
09:23
Add tests to improve coverage of code in window.c. Fix a problem with "SELECT row_number() OVER ()". file: [79be282a] check-in: [f41b6b73] user: dan branch: exp-window-functions, size: 67935
2018-06-18
20:34
Fix problems with using window functions in CREATE VIEW statements. file: [32a74770] check-in: [943bccd2] user: dan branch: exp-window-functions, size: 66762
16:55
Add new API function sqlite3_create_window_function(), for creating new aggregate window functions. file: [7cd40b85] check-in: [da03fb43] user: dan branch: exp-window-functions, size: 66277
2018-06-15
20:46
Add extra OOM test. file: [d80ec071] check-in: [ac251f72] user: dan branch: exp-window-functions, size: 66769
19:01
Fix another problem in lead()/lag(). And some errors that could occur following OOM faults. file: [ffc0a18a] check-in: [fadd4dc1] user: dan branch: exp-window-functions, size: 66848
16:10
Fix a bug in the lead() and lag() window functions causing them to fail when used in queries featuring multiple window functions. file: [3c94dfff] check-in: [3839fb18] user: dan branch: exp-window-functions, size: 66628
2018-06-14
20:52
Fix a problem with handling of statements containing two or more different windows. file: [8d9999b2] check-in: [567e09ef] user: dan branch: exp-window-functions, size: 66641
19:06
Fix problem with window functions min() and max() when used with a PARTITION clause and a frame starting point other than "UNBOUNDED PRECEDING". file: [3fc03f5a] check-in: [43eb1e75] user: dan branch: exp-window-functions, size: 66647
14:27
Improve comments and code legibility in new file window.c. file: [0a6b366a] check-in: [bb915854] user: dan branch: exp-window-functions, size: 66049
2018-06-13
20:29
Fix problems with "RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING" window frames. file: [4a26ff62] check-in: [c34f31db] user: dan branch: exp-window-functions, size: 63100
2018-06-12
20:53
Fix another issue to do with window-functions in aggregate queries. file: [45d149fe] check-in: [6413e38a] user: dan branch: exp-window-functions, size: 60366
18:40
Fix some problems with using window-functions in aggregate queries. file: [5fc1e9a4] check-in: [fe7081e0] user: dan branch: exp-window-functions, size: 58282
2018-06-11
20:50
Clarify the relationship between a Window object and its associated Expr. file: [a5ebf5b1] check-in: [0cd55e98] user: dan branch: exp-window-functions, size: 53353
18:16
Fix handling of window frames containing negative number of rows. e.g. "ROWS x PRECEDING AND y PRECEDING" where (x<y). file: [0519e5a0] check-in: [b6d9c7ed] user: dan branch: exp-window-functions, size: 53729
2018-06-09
17:43
Add support for FILTER clause on aggregate window functions. file: [72c08229] check-in: [ceaf798e] user: dan branch: exp-window-functions, size: 52677
2018-06-08
20:58
Add support for the WINDOW clause. file: [31bd22de] check-in: [19c983b5] user: dan branch: exp-window-functions, size: 51813
16:11
Do not flatten sub-queries that contain window functions. file: [141a79da] check-in: [236cb75b] user: dan branch: exp-window-functions, size: 51037
2018-06-07
20:08
Add window functions lag() and lead(). file: [4a476f74] check-in: [ef342070] user: dan branch: exp-window-functions, size: 50198
17:45
Add support for window function first_value(). file: [c48dd2d7] check-in: [060b2640] user: dan branch: exp-window-functions, size: 48009
15:54
Fix problems with the nth_value() function. file: [7a79e54c] check-in: [63002b9a] user: dan branch: exp-window-functions, size: 47343
2018-06-06
20:51
Add implementation of nth_value() window function. file: [1da8978d] check-in: [eb1fb420] user: dan branch: exp-window-functions, size: 47403
2018-06-05
16:16
Add implementation of last_value() window function. file: [7f9f2c8a] check-in: [2493ce1a] user: dan branch: exp-window-functions, size: 44836
2018-06-04
18:55
Add implementation of window function ntile(). file: [ea479ab9] check-in: [3f093f60] user: dan branch: exp-window-functions, size: 43268
08:22
Add support for window function cume_dist(). Improve tests for percent_rank(). file: [0a6bc6bd] check-in: [76543f7d] user: dan branch: exp-window-functions, size: 41392
2018-06-02
21:04
Add support for window functions row_number(), rank(), dense_rank() and percent_rank(). file: [014c6c7a] check-in: [91c1cb7a] user: dan branch: exp-window-functions, size: 40618
2018-06-01
21:00
Allow an entire partition to be cached in a temp table for all types of window frames. This is required by nth_value() and others. file: [59f519e2] check-in: [b5b18f66] user: dan branch: exp-window-functions, size: 29537
2018-05-30
20:44
Allow min() and max() to be used as window functions. file: [1f2b1590] check-in: [c16125a8] user: dan branch: exp-window-functions, size: 24074
2018-05-28
18:30
Further window frame tests and fixes. file: [9877f4e1] check-in: [e74c6e91] user: dan branch: exp-window-functions, size: 21723
2018-05-26
21:17
More fixes for different window frame types. file: [e6132281] check-in: [2c85668a] user: dan branch: exp-window-functions, size: 21553
2018-05-25
20:30
Fix "RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING" window frame processing. file: [793ad5ff] check-in: [b4e9c686] user: dan branch: exp-window-functions, size: 21397
09:29
Fixes for "ROWS BETWEEN <expr> FOLLOWING AND <expr> FOLLOWING" and "ROWS BETWEEN <expr> FOLLOWING AND UNBOUNDED FOLLOWING" file: [4f9f7cef] check-in: [5ac44872] user: dan branch: exp-window-functions, size: 19281
2018-05-24
21:10
Allow "<expr> PRECEDING" to be used to specify the end of a window frame. file: [e4441e8e] check-in: [7b709a98] user: dan branch: exp-window-functions, size: 18828
17:49
Support other frame types that use "<expr> PRECEDING" or "<expr> FOLLOWING" as start or end conditions. file: [dc58ad62] check-in: [ec7b648c] user: dan branch: exp-window-functions, size: 17806
2018-05-23
20:55
Add support for "ROWS BETWEEN <expr> PRECEDING AND <expr> FOLLOWING" window frames. file: [1313e941] check-in: [3a203660] user: dan branch: exp-window-functions, size: 16908
2018-05-22
20:35
Add comments to window.c describing how other window frames will be implemented. file: [37eb02c2] check-in: [16168146] user: dan branch: exp-window-functions, size: 10464
2018-05-21
19:45
Begin adding support for more esoteric window frames. file: [da24f2e5] check-in: [bc4b81d6] user: dan branch: exp-window-functions, size: 8632
2018-05-17
19:24
Evaluate multiple window functions in a single pass if they use the same window definition. Add xValue callbacks for other built-in aggregate functions. file: [33d3751e] check-in: [c9f0f140] user: dan branch: exp-window-functions, size: 1849
2018-05-16
20:58
Start of experimental implementation of SQL window functions. Does not yet work. file: [33cc7de7] check-in: [3781e520] user: dan branch: exp-window-functions, size: 1276 Added