mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #63128 from den-crane/test/issue_47217
add tests for #47217, #55965
This commit is contained in:
commit
08ef9a2eea
@ -0,0 +1,3 @@
|
||||
a 0.5 4
|
||||
a 1
|
||||
b 1
|
41
tests/queries/0_stateless/03142_window_function_limit_by.sql
Normal file
41
tests/queries/0_stateless/03142_window_function_limit_by.sql
Normal file
@ -0,0 +1,41 @@
|
||||
SET allow_experimental_analyzer = 1;
|
||||
|
||||
|
||||
-- https://github.com/ClickHouse/ClickHouse/issues/55965
|
||||
|
||||
CREATE TABLE error_win_func
|
||||
(
|
||||
`k` String,
|
||||
`in` UInt64,
|
||||
`out` UInt64
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY k AS
|
||||
SELECT * from VALUES (('a', 2, 4), ('a', 4, 2), ('a', 6, 3), ('a', 8, 4));
|
||||
|
||||
SELECT
|
||||
k,
|
||||
in / out AS ratio,
|
||||
count(*) OVER w AS count_rows_w
|
||||
FROM error_win_func
|
||||
WINDOW
|
||||
w AS (ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING)
|
||||
LIMIT 1 BY
|
||||
k;
|
||||
|
||||
DROP TABLE error_win_func;
|
||||
|
||||
-- https://github.com/ClickHouse/ClickHouse/issues/47217
|
||||
|
||||
CREATE TABLE t(n String, st String) ENGINE = Memory as
|
||||
select * from values(('a', 'x'), ('b', 'y'), ('c', 'z'));
|
||||
|
||||
SELECT
|
||||
n as m,
|
||||
count() OVER (PARTITION BY m) cnt
|
||||
FROM t
|
||||
WHERE st IN ('x', 'y')
|
||||
LIMIT 1 BY m;
|
||||
|
||||
DROP TABLE t;
|
||||
|
Loading…
Reference in New Issue
Block a user