ClickHouse/tests/queries/0_stateless/00996_limit_with_ties.sql

39 lines
1.3 KiB
MySQL
Raw Normal View History

2019-08-26 21:00:16 +00:00
DROP TABLE IF EXISTS ties;
CREATE TABLE ties (a Int) ENGINE = Memory;
2019-08-27 18:11:02 +00:00
INSERT INTO ties VALUES (1), (1), (2), (2), (2), (2) (3), (3);
2019-08-26 21:00:16 +00:00
SELECT a FROM ties order by a limit 1 with ties;
SELECT '*';
SELECT a FROM ties order by a limit 3 with ties;
SELECT '*';
SELECT a FROM ties order by a limit 5 with ties;
SELECT '*';
SET max_block_size = 2;
2019-08-27 18:11:02 +00:00
SELECT a FROM ties order by a limit 1, 1 with ties;
SELECT '*';
SELECT a FROM ties order by a limit 1, 2 with ties;
2019-08-26 21:00:16 +00:00
SELECT '*';
SELECT a FROM ties order by a limit 2 with ties;
SELECT '*';
2019-08-27 18:11:02 +00:00
SELECT a FROM ties order by a limit 2, 3 with ties;
2019-08-26 21:00:16 +00:00
SELECT '*';
SELECT a FROM ties order by a limit 4 with ties;
SELECT '*';
SET max_block_size = 3;
SELECT a FROM ties order by a limit 1 with ties;
SELECT '*';
2019-08-27 18:11:02 +00:00
SELECT a FROM ties order by a limit 2, 3 with ties;
2019-08-26 21:00:16 +00:00
SELECT '*';
2019-08-27 18:11:02 +00:00
SELECT a FROM ties order by a limit 3, 2 with ties;
2019-08-26 21:00:16 +00:00
SELECT '*';
2020-02-28 20:20:39 +00:00
select count() from (select number > 100 from numbers(2000) order by number > 100 limit 1, 7 with ties); --TODO replace "number > 100" with "number > 100 as n"
select count() from (select number, number < 100 from numbers(2000) order by number < 100 desc limit 10 with ties);
2020-03-02 12:56:47 +00:00
SET max_block_size = 5;
select count() from (select number < 100, number from numbers(2000) order by number < 100 desc limit 10 with ties);
2020-02-28 20:20:39 +00:00
2019-08-26 21:00:16 +00:00
DROP TABLE ties;