Updated test [#CLICKHOUSE-3]

This commit is contained in:
Alexey Milovidov 2018-10-17 09:02:48 +03:00
parent 72e4963248
commit ce67ebdded
2 changed files with 9 additions and 8 deletions

View File

@ -1,7 +1,7 @@
DROP TABLE IF EXISTS users.perf; DROP TABLE IF EXISTS test.perf;
CREATE TABLE users.perf (site String, user_id UInt64, z Float64) ENGINE = Log; CREATE TABLE test.perf (site String, user_id UInt64, z Float64) ENGINE = Log;
SELECT * FROM (SELECT perf_1.z AS z_1 FROM users.perf AS perf_1); SELECT * FROM (SELECT perf_1.z AS z_1 FROM test.perf AS perf_1);
SELECT sum(mul)/sqrt(sum(sqr_dif_1) * sum(sqr_dif_2)) AS z_r SELECT sum(mul)/sqrt(sum(sqr_dif_1) * sum(sqr_dif_2)) AS z_r
FROM( FROM(
@ -10,11 +10,11 @@ SELECT
avg(z_2) AS z_2_avg avg(z_2) AS z_2_avg
FROM ( FROM (
SELECT perf_1.site, perf_1.z AS z_1 SELECT perf_1.site, perf_1.z AS z_1
FROM users.perf AS perf_1 FROM test.perf AS perf_1
WHERE user_id = 000 WHERE user_id = 000
) ALL INNER JOIN ( ) ALL INNER JOIN (
SELECT perf_2.site, perf_2.z AS z_2 SELECT perf_2.site, perf_2.z AS z_2
FROM users.perf AS perf_2 FROM test.perf AS perf_2
WHERE user_id = 999 WHERE user_id = 999
) USING site) as avg_values, ) USING site) as avg_values,
z_1 - avg_values.1 AS dif_1, z_1 - avg_values.1 AS dif_1,
@ -24,12 +24,12 @@ SELECT
dif_2*dif_2 AS sqr_dif_2 dif_2*dif_2 AS sqr_dif_2
FROM ( FROM (
SELECT perf_1.site, perf_1.z AS z_1 SELECT perf_1.site, perf_1.z AS z_1
FROM users.perf AS perf_1 FROM test.perf AS perf_1
WHERE user_id = 000 WHERE user_id = 000
) ALL INNER JOIN ( ) ALL INNER JOIN (
SELECT perf_2.site, perf_2.z AS z_2 SELECT perf_2.site, perf_2.z AS z_2
FROM users.perf AS perf_2 FROM test.perf AS perf_2
WHERE user_id = 999 WHERE user_id = 999
) USING site); ) USING site);
DROP TABLE users.perf; DROP TABLE test.perf;