Commit Graph

72 Commits

Author SHA1 Message Date
Nikolai Kochetov
254eecf227 Update some tests. 2021-10-19 11:11:54 +03:00
Alexey Milovidov
06fc466438 Remove window function 'nth_value' 2021-09-25 04:39:38 +03:00
Azat Khuzhin
b383115389 Allow values up to INT64_MAX for nth_value/lagInFrame/leadInFrame 2021-09-10 21:02:06 +03:00
Azat Khuzhin
62a29420bd Fix signed integer overflow for nth_value() window function
CI report [1]:

    ../src/Processors/Transforms/WindowTransform.cpp:1699:54: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long' Received signal -3 Received signal Unknown signal (-3)

In query:

    SELECT
        number,
        nth_value(number, 2147483648) OVER w,
        anyOrNull(number) OVER (ORDER BY -2147483648 - intDiv(number, 1024) DESC NULLS FIRST, number DESC ROWS BETWEEN 65535 FOLLOWING AND UNBOUNDED FOLLOWING),
        nth_value(number, 65537) OVER w AS firstValue,
        nth_value(number, -9223372036854775808) OVER w AS secondValue,
        nth_value(number, 1048576) OVER w AS thirdValue
    FROM numbers(1)
    WINDOW w AS (ORDER BY number DESC)
    ORDER BY number DESC

  [1]: https://clickhouse-test-reports.s3.yandex.net/28532/7623af5513e12aa8dfa1bee963caffe00185c31a/fuzzer_ubsan/report.html#fail1
2021-09-10 21:02:04 +03:00
Alexander Kuzmenkov
4bc652699f
Merge pull request #27184 from ClickHouse/aku/window-functions
mark window functions as ready for general use
2021-08-05 14:18:28 +03:00
Alexander Kuzmenkov
b190e499ee fixup 2021-08-04 17:46:25 +03:00
Alexander Kuzmenkov
0730e685b0 Mark window functions ready for general use. 2021-08-04 17:45:32 +03:00
Alexander Kuzmenkov
55e1d1b592 the reference was correct after all, I just confused the sides of the
diff
2021-07-29 15:49:37 +03:00
Alexander Kuzmenkov
7c9467d7a7 fix window function partition boundary search
It was horribly broken and many test references were wrong. I'm
surprised I never noticed this.
2021-07-29 15:18:10 +03:00
ryzuo
4d36d54c81 Update the implementaion of nth_value
Make nth_value for nullable values for out of frame rows, as the same
fashion as lagInFrame just does.
2021-07-23 00:34:08 +08:00
ryzuo
94d4fb9dfc Cleanup the incomplete fix of nullability return value of lagInFrame/leadInFrame 2021-07-22 10:37:29 +08:00
ryzuo
df9ec5655c Add missing test back in 01591_window_function 2021-07-22 10:30:10 +08:00
ryzuo
fd0c016423 Make tests of nth_value pass 2021-07-22 10:22:24 +08:00
ryzuo
4eb053a303 Implementaion of window function nth_value.
1. Implemented the window function nth_value
2. Make the return type of lag/lead, and nth_value functions to be
ColumnNullable, thus the returned value can be null if it is out
of frame.
2021-07-22 10:19:19 +08:00
Alexander Kuzmenkov
a197511a96 fixes 2021-07-21 01:36:15 +03:00
Alexander Kuzmenkov
61a01782a6 fix lagInFrame for nullable types 2021-07-19 19:31:57 +03:00
Alexander Kuzmenkov
3824ba656c
Merge pull request #24576 from ClickHouse/aku/inherit-window
allow inheriting from a named window in window definition
2021-05-28 23:43:35 +03:00
Alexander Kuzmenkov
9fc51aef68 fix 2021-05-27 21:39:52 +03:00
Alexander Kuzmenkov
1c21281456 do not auto-apply -OrNull combinator to pure window functions 2021-05-27 18:21:08 +03:00
Alexander Kuzmenkov
7c6399d82d fixes 2021-05-27 17:45:40 +03:00
Alexander Kuzmenkov
1fe3fd864e Merge remote-tracking branch 'origin/master' into HEAD 2021-04-23 10:41:35 +03:00
Alexander Kuzmenkov
ce0a58f86f ignore empty input chunks generated by joins 2021-04-23 10:37:47 +03:00
Ivan
57f61c954c
Another attempt to enable pytest (#22664)
* Fix some tests

* Fix tests
2021-04-14 19:35:17 +03:00
Alexander Kuzmenkov
d9ad06bd6d fix ubsan 2021-04-06 19:24:56 +03:00
Alexander Kuzmenkov
ac97f7df29
Update 01591_window_functions.reference 2021-04-01 20:16:59 +03:00
Alexander Kuzmenkov
d006c5532e fix window frame offset check and add more tests 2021-04-01 18:56:58 +03:00
Alexander Kuzmenkov
8ea697b7df use camelCase 2021-03-25 18:49:45 +03:00
Alexander Kuzmenkov
b0284f20c3
Merge branch 'master' into aku/laglead 2021-03-22 21:16:27 +03:00
Alexander Kuzmenkov
ac5fdda999
Merge pull request #21915 from ClickHouse/aku/window-mt-order
disable optimize_read_in_order for window functions
2021-03-22 17:21:00 +03:00
Alexander Kuzmenkov
590259a7a5 disable optimize_read_in_order for window functions 2021-03-19 17:29:09 +03:00
Alexander Kuzmenkov
1beba597ca Merge remote-tracking branch 'origin/master' into HEAD 2021-03-19 02:11:08 +03:00
Alexander Kuzmenkov
6aa9039f7d float frames and lag/lead_in_frame 2021-03-19 02:05:43 +03:00
Alexander Kuzmenkov
3c16ea0bc8 fix incorrect number of rows for Chunks with no columns in PartialSortingTransform 2021-03-16 01:59:12 +03:00
Alexander Kuzmenkov
824475b224 cleanup 2021-02-12 13:37:27 +03:00
Alexander Kuzmenkov
d8f9a8d3cd first_value and last_value 2021-02-11 18:41:54 +03:00
Alexander Kuzmenkov
ecbcf47f28 lag/lead stubs + cleanup 2021-02-11 18:07:42 +03:00
Alexander Kuzmenkov
525400bc41 window function rank() and friends 2021-02-11 16:29:30 +03:00
Alexander Kuzmenkov
363007b964 fixes 2021-02-11 11:39:39 +03:00
Alexander Kuzmenkov
5bd9c8b122 update reference 2021-02-10 17:42:45 +03:00
Alexander Kuzmenkov
ba0cd9677c update reference 2021-02-10 16:44:00 +03:00
Alexander Kuzmenkov
e557d60cdb fixes for sort order 2021-02-10 16:27:22 +03:00
Alexander Kuzmenkov
c18749a704 fix a bug and add some tests 2021-02-09 17:44:04 +03:00
Alexander Kuzmenkov
6e40b9fb6c fix for the DESC frame 2021-02-09 14:56:58 +03:00
Alexander Kuzmenkov
4bb38f333b some simple cases 2021-02-05 18:34:03 +03:00
Alexander Kuzmenkov
c1c71fc8e9 ROWS OFFSET frame end 2021-02-04 10:41:09 +03:00
Alexander Kuzmenkov
ec382d8812 BETWEEN CURRENT ROW AND CURRENT ROW 2021-02-03 17:55:40 +03:00
Alexander Kuzmenkov
35754abb4a CURRENT ROW frame start for RANGE frame 2021-02-03 17:22:37 +03:00
Alexander Kuzmenkov
7c55ecf67d cleanup 2021-02-03 16:41:59 +03:00
Alexander Kuzmenkov
f31d2206a7 more fuzzing and less bugs 2021-02-03 15:50:25 +03:00
Alexander Kuzmenkov
a164abf23e add frame fuzzing and one query that fails under msan 2021-02-03 09:42:54 +03:00