ClickHouse/tests/queries/0_stateless/02016_aggregation_spark_bar.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
2.3 KiB
MySQL
Raw Normal View History

2021-08-15 11:50:32 +00:00
DROP TABLE IF EXISTS spark_bar_test;
2021-08-09 15:14:51 +00:00
CREATE TABLE spark_bar_test (`cnt` UInt64,`event_date` Date) ENGINE = MergeTree ORDER BY event_date SETTINGS index_granularity = 8192;
2021-08-15 11:50:32 +00:00
INSERT INTO spark_bar_test VALUES(1,'2020-01-01'),(4,'2020-01-02'),(5,'2020-01-03'),(2,'2020-01-04'),(3,'2020-01-05'),(7,'2020-01-06'),(6,'2020-01-07'),(8,'2020-01-08'),(2,'2020-01-11');
2021-08-09 15:14:51 +00:00
2021-08-17 09:35:19 +00:00
SELECT sparkbar(1)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(2)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(3)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(4)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(5)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(6)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(7)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(8)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(9)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(10)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(11)(event_date,cnt) FROM spark_bar_test;
2021-08-15 11:50:32 +00:00
2021-08-17 09:35:19 +00:00
SELECT sparkbar(11,2,5)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(11,3,7)(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(11,4,11)(event_date,cnt) FROM spark_bar_test;
2021-08-15 11:50:32 +00:00
2021-08-17 09:35:19 +00:00
SELECT sparkbar(11,toDate('2020-01-02'),toDate('2020-01-02'))(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(11,toDate('2020-01-02'),toDate('2020-01-05'))(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(11,toDate('2020-01-03'),toDate('2020-01-07'))(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(11,toDate('2020-01-04'),toDate('2020-01-11'))(event_date,cnt) FROM spark_bar_test;
2021-08-17 09:35:19 +00:00
SELECT sparkbar(2,toDate('2020-01-01'),toDate('2020-01-08'))(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(2,toDate('2020-01-02'),toDate('2020-01-09'))(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(3,toDate('2020-01-01'),toDate('2020-01-09'))(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(3,toDate('2020-01-01'),toDate('2020-01-10'))(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(4,toDate('2020-01-01'),toDate('2020-01-08'))(event_date,cnt) FROM spark_bar_test;
SELECT sparkbar(5,toDate('2020-01-01'),toDate('2020-01-10'))(event_date,cnt) FROM spark_bar_test;
DROP TABLE IF EXISTS spark_bar_test;
2021-11-22 10:07:08 +00:00
WITH number DIV 50 AS k, number % 50 AS value SELECT k, sparkbar(50, 0, 99)(number, value) FROM numbers(100) GROUP BY k ORDER BY k;