fix asof big test (timeout & name)

This commit is contained in:
chertus 2019-04-08 13:20:18 +03:00
parent b32c19c1b6
commit 54ae20024f
4 changed files with 17 additions and 32 deletions

View File

@ -1,31 +0,0 @@
USE test;
DROP TABLE IF EXISTS tvs;
DROP TABLE IF EXISTS trades;
DROP TABLE IF EXISTS keys;
DROP TABLE IF EXISTS tv_times;
DROP TABLE IF EXISTS trade_times;
CREATE TABLE keys(k UInt32) ENGINE = MergeTree() ORDER BY k;
INSERT INTO keys(k) SELECT number FROM system.numbers LIMIT 5000;
CREATE TABLE tv_times(t UInt32) ENGINE = MergeTree() ORDER BY t;
INSERT INTO tv_times(t) SELECT number * 3 FROM system.numbers LIMIT 50000;
CREATE TABLE trade_times(t UInt32) ENGINE = MergeTree() ORDER BY t;
INSERT INTO trade_times(t) SELECT number * 10 FROM system.numbers LIMIT 15000;
CREATE TABLE tvs(k UInt32, t UInt32, tv UInt64) ENGINE = MergeTree() ORDER BY (k, t);
INSERT INTO tvs(k,t,tv) SELECT k, t, t FROM keys CROSS JOIN tv_times;
CREATE TABLE trades(k UInt32, t UInt32, price UInt64) ENGINE = MergeTree() ORDER BY (k, t);
INSERT INTO trades(k,t,price) SELECT k, t, t FROM keys CROSS JOIN trade_times;
SELECT SUM(trades.price - tvs.tv) FROM trades ASOF LEFT JOIN tvs USING(k,t);
DROP TABLE tvs;
DROP TABLE trades;
DROP TABLE keys;
DROP TABLE tv_times;
DROP TABLE trade_times;

View File

@ -0,0 +1 @@
3000000

View File

@ -0,0 +1,16 @@
USE test;
DROP TABLE IF EXISTS tvs;
CREATE TABLE tvs(k UInt32, t UInt32, tv UInt64) ENGINE = Memory;
INSERT INTO tvs(k,t,tv) SELECT k, t, t
FROM (SELECT toUInt32(number) AS k FROM numbers(1000)) keys
CROSS JOIN (SELECT toUInt32(number * 3) as t FROM numbers(10000)) tv_times;
SELECT SUM(trades.price - tvs.tv) FROM
(SELECT k, t, t as price
FROM (SELECT toUInt32(number) AS k FROM numbers(1000)) keys
CROSS JOIN (SELECT toUInt32(number * 10) AS t FROM numbers(3000)) trade_times) trades
ASOF LEFT JOIN tvs USING(k,t);
DROP TABLE tvs;