mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fix some tests
This commit is contained in:
parent
a8fee10059
commit
f24a4ef9a4
@ -9,3 +9,4 @@ SELECT s, n.x, n.y FROM nested_test ARRAY JOIN nest AS n;
|
||||
SELECT s, n.x, n.y, nest.x FROM nested_test ARRAY JOIN nest AS n;
|
||||
SELECT s, n.x, n.y, nest.x, nest.y FROM nested_test ARRAY JOIN nest AS n;
|
||||
SELECT s, n.x, n.y, nest.x, nest.y, num FROM nested_test ARRAY JOIN nest AS n, arrayEnumerate(nest.x) AS num;
|
||||
DROP TABLE nested_test;
|
||||
|
@ -125,3 +125,4 @@ CREATE TABLE addresses(addr String) ENGINE = Memory;
|
||||
INSERT INTO addresses(addr) VALUES ('00000000000000000000FFFFC1FC110A'), ('00000000000000000000FFFF4D583737'), ('00000000000000000000FFFF7F000001');
|
||||
SELECT cutIPv6(toFixedString(unhex(addr), 16), 0, 3) FROM addresses ORDER BY addr ASC;
|
||||
|
||||
DROP TABLE addresses;
|
||||
|
@ -39,3 +39,5 @@ INSERT INTO summing (k, s) VALUES (0, 1), (666, 1), (666, 0);
|
||||
OPTIMIZE TABLE summing PARTITION 197001;
|
||||
|
||||
SELECT k, s FROM summing ORDER BY k;
|
||||
|
||||
DROP TABLE summing;
|
||||
|
@ -1,13 +1,13 @@
|
||||
DROP TABLE IF EXISTS test.report1;
|
||||
DROP TABLE IF EXISTS test.report2;
|
||||
DROP TABLE IF EXISTS report1;
|
||||
DROP TABLE IF EXISTS report2;
|
||||
|
||||
CREATE TABLE test.report1(id UInt32, event_date Date, priority UInt32, description String) ENGINE = MergeTree(event_date, intHash32(id), (id, event_date, intHash32(id)), 8192);
|
||||
CREATE TABLE test.report2(id UInt32, event_date Date, priority UInt32, description String) ENGINE = MergeTree(event_date, intHash32(id), (id, event_date, intHash32(id)), 8192);
|
||||
CREATE TABLE report1(id UInt32, event_date Date, priority UInt32, description String) ENGINE = MergeTree(event_date, intHash32(id), (id, event_date, intHash32(id)), 8192);
|
||||
CREATE TABLE report2(id UInt32, event_date Date, priority UInt32, description String) ENGINE = MergeTree(event_date, intHash32(id), (id, event_date, intHash32(id)), 8192);
|
||||
|
||||
INSERT INTO test.report1(id,event_date,priority,description) VALUES (1, '2015-01-01', 1, 'foo')(2, '2015-02-01', 2, 'bar')(3, '2015-03-01', 3, 'foo')(4, '2015-04-01', 4, 'bar')(5, '2015-05-01', 5, 'foo');
|
||||
INSERT INTO test.report2(id,event_date,priority,description) VALUES (1, '2016-01-01', 6, 'bar')(2, '2016-02-01', 7, 'foo')(3, '2016-03-01', 8, 'bar')(4, '2016-04-01', 9, 'foo')(5, '2016-05-01', 10, 'bar');
|
||||
INSERT INTO report1(id,event_date,priority,description) VALUES (1, '2015-01-01', 1, 'foo')(2, '2015-02-01', 2, 'bar')(3, '2015-03-01', 3, 'foo')(4, '2015-04-01', 4, 'bar')(5, '2015-05-01', 5, 'foo');
|
||||
INSERT INTO report2(id,event_date,priority,description) VALUES (1, '2016-01-01', 6, 'bar')(2, '2016-02-01', 7, 'foo')(3, '2016-03-01', 8, 'bar')(4, '2016-04-01', 9, 'foo')(5, '2016-05-01', 10, 'bar');
|
||||
|
||||
SELECT * FROM (SELECT id, event_date, priority, description FROM remote('127.0.0.{2,3}', test, report1) UNION ALL SELECT id, event_date, priority, description FROM remote('127.0.0.{2,3}', test, report2)) ORDER BY id, event_date ASC;
|
||||
SELECT * FROM (SELECT id, event_date, priority, description FROM remote('127.0.0.{2,3}', currentDatabase(), report1) UNION ALL SELECT id, event_date, priority, description FROM remote('127.0.0.{2,3}', currentDatabase(), report2)) ORDER BY id, event_date ASC;
|
||||
|
||||
DROP TABLE test.report1;
|
||||
DROP TABLE test.report2;
|
||||
DROP TABLE report1;
|
||||
DROP TABLE report2;
|
||||
|
@ -1,9 +1,9 @@
|
||||
SET max_memory_usage = 100000000;
|
||||
SET max_bytes_before_external_sort = 20000000;
|
||||
|
||||
DROP TABLE IF EXISTS test.numbers10m;
|
||||
CREATE VIEW test.numbers10m AS SELECT number FROM system.numbers LIMIT 10000000;
|
||||
DROP TABLE IF EXISTS numbers10m;
|
||||
CREATE VIEW numbers10m AS SELECT number FROM system.numbers LIMIT 10000000;
|
||||
|
||||
SELECT number FROM remote('127.0.0.{2,3}', test, numbers10m) ORDER BY number * 1234567890123456789 LIMIT 19999980, 20;
|
||||
SELECT number FROM remote('127.0.0.{2,3}', currentDatabase(), numbers10m) ORDER BY number * 1234567890123456789 LIMIT 19999980, 20;
|
||||
|
||||
DROP TABLE test.numbers10m;
|
||||
DROP TABLE numbers10m;
|
||||
|
@ -4,34 +4,34 @@ SELECT '';
|
||||
SELECT length(toString(groupArrayState(toDate(number)))) FROM (SELECT * FROM system.numbers LIMIT 10);
|
||||
SELECT length(toString(groupArrayState(toDateTime(number)))) FROM (SELECT * FROM system.numbers LIMIT 10);
|
||||
|
||||
DROP TABLE IF EXISTS test.numbers_mt;
|
||||
CREATE TABLE test.numbers_mt (number UInt64) ENGINE = Log;
|
||||
INSERT INTO test.numbers_mt SELECT * FROM system.numbers LIMIT 1, 1000000;
|
||||
DROP TABLE IF EXISTS numbers_mt;
|
||||
CREATE TABLE numbers_mt (number UInt64) ENGINE = Log;
|
||||
INSERT INTO numbers_mt SELECT * FROM system.numbers LIMIT 1, 1000000;
|
||||
|
||||
SELECT count(), sum(ns), max(ns) FROM (SELECT intDiv(number, 100) AS k, groupArray(number) AS ns FROM test.numbers_mt GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(toUInt64(ns)), max(toUInt64(ns)) FROM (SELECT intDiv(number, 100) AS k, groupArray(toString(number)) AS ns FROM test.numbers_mt GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(toUInt64(ns[1])), max(toUInt64(ns[1])), sum(toUInt64(ns[2]))/10 FROM (SELECT intDiv(number, 100) AS k, groupArray([toString(number), toString(number*10)]) AS ns FROM test.numbers_mt GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(ns[1]), max(ns[1]), sum(ns[2])/10 FROM (SELECT intDiv(number, 100) AS k, groupArray([number, number*10]) AS ns FROM test.numbers_mt GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(ns), max(ns) FROM (SELECT intDiv(number, 100) AS k, groupArray(number) AS ns FROM numbers_mt GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(toUInt64(ns)), max(toUInt64(ns)) FROM (SELECT intDiv(number, 100) AS k, groupArray(toString(number)) AS ns FROM numbers_mt GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(toUInt64(ns[1])), max(toUInt64(ns[1])), sum(toUInt64(ns[2]))/10 FROM (SELECT intDiv(number, 100) AS k, groupArray([toString(number), toString(number*10)]) AS ns FROM numbers_mt GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(ns[1]), max(ns[1]), sum(ns[2])/10 FROM (SELECT intDiv(number, 100) AS k, groupArray([number, number*10]) AS ns FROM numbers_mt GROUP BY k) ARRAY JOIN ns;
|
||||
|
||||
SELECT count(), sum(ns), max(ns) FROM (SELECT intDiv(number, 100) AS k, groupArray(number) AS ns FROM remote('127.0.0.{2,3}', 'test', 'numbers_mt') GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(toUInt64(ns)), max(toUInt64(ns)) FROM (SELECT intDiv(number, 100) AS k, groupArray(toString(number)) AS ns FROM remote('127.0.0.{2,3}', 'test', 'numbers_mt') GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(toUInt64(ns[1])), max(toUInt64(ns[1])), sum(toUInt64(ns[2]))/10 FROM (SELECT intDiv(number, 100) AS k, groupArray([toString(number), toString(number*10)]) AS ns FROM remote('127.0.0.{2,3}', 'test', 'numbers_mt') GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(ns), max(ns) FROM (SELECT intDiv(number, 100) AS k, groupArray(number) AS ns FROM remote('127.0.0.{2,3}', currentDatabase(), 'numbers_mt') GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(toUInt64(ns)), max(toUInt64(ns)) FROM (SELECT intDiv(number, 100) AS k, groupArray(toString(number)) AS ns FROM remote('127.0.0.{2,3}', currentDatabase(), 'numbers_mt') GROUP BY k) ARRAY JOIN ns;
|
||||
SELECT count(), sum(toUInt64(ns[1])), max(toUInt64(ns[1])), sum(toUInt64(ns[2]))/10 FROM (SELECT intDiv(number, 100) AS k, groupArray([toString(number), toString(number*10)]) AS ns FROM remote('127.0.0.{2,3}', currentDatabase(), 'numbers_mt') GROUP BY k) ARRAY JOIN ns;
|
||||
|
||||
DROP TABLE test.numbers_mt;
|
||||
CREATE TABLE test.numbers_mt (number UInt64) ENGINE = Log;
|
||||
INSERT INTO test.numbers_mt SELECT * FROM system.numbers LIMIT 1, 1048575;
|
||||
DROP TABLE numbers_mt;
|
||||
CREATE TABLE numbers_mt (number UInt64) ENGINE = Log;
|
||||
INSERT INTO numbers_mt SELECT * FROM system.numbers LIMIT 1, 1048575;
|
||||
|
||||
SELECT '';
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)(number AS i)), length(groupArray(1024)(i)), length(groupArray(65536)(i)) AS s FROM test.numbers_mt GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)(hex(number) AS i)), length(groupArray(1024)(i)), length(groupArray(65536)(i)) AS s FROM test.numbers_mt GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)([hex(number)] AS i)), length(groupArray(1024)(i)), length(groupArray(65536)(i)) AS s FROM test.numbers_mt GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)(number AS i)), length(groupArray(1024)(i)), length(groupArray(65536)(i)) AS s FROM numbers_mt GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)(hex(number) AS i)), length(groupArray(1024)(i)), length(groupArray(65536)(i)) AS s FROM numbers_mt GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)([hex(number)] AS i)), length(groupArray(1024)(i)), length(groupArray(65536)(i)) AS s FROM numbers_mt GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
|
||||
SELECT '';
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)(number AS i)), length(groupArray(1500)(i)), length(groupArray(70000)(i)) AS s FROM remote('127.0.0.{2,3}', 'test', 'numbers_mt') GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)(hex(number) AS i)), length(groupArray(1500)(i)), length(groupArray(70000)(i)) AS s FROM remote('127.0.0.{2,3}', 'test', 'numbers_mt') GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)([hex(number)] AS i)), length(groupArray(1500)(i)), length(groupArray(70000)(i)) AS s FROM remote('127.0.0.{2,3}', 'test', 'numbers_mt') GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)(number AS i)), length(groupArray(1500)(i)), length(groupArray(70000)(i)) AS s FROM remote('127.0.0.{2,3}', currentDatabase(), 'numbers_mt') GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)(hex(number) AS i)), length(groupArray(1500)(i)), length(groupArray(70000)(i)) AS s FROM remote('127.0.0.{2,3}', currentDatabase(), 'numbers_mt') GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
SELECT roundToExp2(number) AS k, length(groupArray(1)([hex(number)] AS i)), length(groupArray(1500)(i)), length(groupArray(70000)(i)) AS s FROM remote('127.0.0.{2,3}', currentDatabase(), 'numbers_mt') GROUP BY k ORDER BY k LIMIT 9, 11;
|
||||
|
||||
DROP TABLE test.numbers_mt;
|
||||
DROP TABLE numbers_mt;
|
||||
|
||||
-- Check binary compatibility:
|
||||
-- clickhouse-client -h old -q "SELECT arrayReduce('groupArrayState', [['1'], ['22'], ['333']]) FORMAT RowBinary" | clickhouse-local -s --input-format RowBinary --structure "d AggregateFunction(groupArray2, Array(String))" -q "SELECT groupArray2Merge(d) FROM table"
|
||||
|
@ -1,62 +1,62 @@
|
||||
DROP TABLE IF EXISTS test.buffer_00126;
|
||||
DROP TABLE IF EXISTS test.null_sink_00126;
|
||||
DROP TABLE IF EXISTS buffer_00126;
|
||||
DROP TABLE IF EXISTS null_sink_00126;
|
||||
|
||||
CREATE TABLE test.null_sink_00126 (a UInt8, b String, c Array(UInt32)) ENGINE = Null;
|
||||
CREATE TABLE test.buffer_00126 (a UInt8, b String, c Array(UInt32)) ENGINE = Buffer(test, null_sink_00126, 1, 1000, 1000, 1000, 1000, 1000000, 1000000);
|
||||
CREATE TABLE null_sink_00126 (a UInt8, b String, c Array(UInt32)) ENGINE = Null;
|
||||
CREATE TABLE buffer_00126 (a UInt8, b String, c Array(UInt32)) ENGINE = Buffer(currentDatabase(), null_sink_00126, 1, 1000, 1000, 1000, 1000, 1000000, 1000000);
|
||||
|
||||
INSERT INTO test.buffer_00126 VALUES (1, '2', [3]);
|
||||
INSERT INTO buffer_00126 VALUES (1, '2', [3]);
|
||||
|
||||
SELECT a, b, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, b, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c FROM buffer_00126 ORDER BY a, b, c;
|
||||
|
||||
INSERT INTO test.buffer_00126 (c, b, a) VALUES ([7], '8', 9);
|
||||
INSERT INTO buffer_00126 (c, b, a) VALUES ([7], '8', 9);
|
||||
|
||||
SELECT a, b, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, b, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c FROM buffer_00126 ORDER BY a, b, c;
|
||||
|
||||
INSERT INTO test.buffer_00126 (a, c) VALUES (11, [33]);
|
||||
INSERT INTO buffer_00126 (a, c) VALUES (11, [33]);
|
||||
|
||||
SELECT a, b, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c FROM test.buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, b, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a, c FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b, a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c, b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT a FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT b FROM buffer_00126 ORDER BY a, b, c;
|
||||
SELECT c FROM buffer_00126 ORDER BY a, b, c;
|
||||
|
||||
DROP TABLE test.buffer_00126;
|
||||
DROP TABLE test.null_sink_00126;
|
||||
DROP TABLE buffer_00126;
|
||||
DROP TABLE null_sink_00126;
|
||||
|
@ -1,23 +1,23 @@
|
||||
DROP TABLE IF EXISTS test.mt_00160;
|
||||
DROP TABLE IF EXISTS test.merge_00160;
|
||||
DROP TABLE IF EXISTS mt_00160;
|
||||
DROP TABLE IF EXISTS merge_00160;
|
||||
|
||||
CREATE TABLE test.mt_00160 (d Date DEFAULT toDate('2015-05-01'), x UInt64) ENGINE = MergeTree(d, x, 1);
|
||||
CREATE TABLE test.merge_00160 (d Date, x UInt64) ENGINE = Merge(test, '^mt_00160$');
|
||||
CREATE TABLE mt_00160 (d Date DEFAULT toDate('2015-05-01'), x UInt64) ENGINE = MergeTree(d, x, 1);
|
||||
CREATE TABLE merge_00160 (d Date, x UInt64) ENGINE = Merge(currentDatabase(), '^mt_00160$');
|
||||
|
||||
SET min_insert_block_size_rows = 0, min_insert_block_size_bytes = 0;
|
||||
SET max_block_size = 1000000;
|
||||
INSERT INTO test.mt_00160 (x) SELECT number AS x FROM system.numbers LIMIT 100000;
|
||||
INSERT INTO mt_00160 (x) SELECT number AS x FROM system.numbers LIMIT 100000;
|
||||
|
||||
SELECT *, b FROM test.mt_00160 WHERE x IN (12345, 67890) AND NOT ignore(blockSize() < 10 AS b) ORDER BY x;
|
||||
SELECT *, b FROM test.merge_00160 WHERE x IN (12345, 67890) AND NOT ignore(blockSize() < 10 AS b) ORDER BY x;
|
||||
SELECT *, b FROM mt_00160 WHERE x IN (12345, 67890) AND NOT ignore(blockSize() < 10 AS b) ORDER BY x;
|
||||
SELECT *, b FROM merge_00160 WHERE x IN (12345, 67890) AND NOT ignore(blockSize() < 10 AS b) ORDER BY x;
|
||||
|
||||
DROP TABLE test.merge_00160;
|
||||
DROP TABLE test.mt_00160;
|
||||
DROP TABLE merge_00160;
|
||||
DROP TABLE mt_00160;
|
||||
|
||||
CREATE TABLE test.mt_00160 (d Date DEFAULT toDate('2015-05-01'), x UInt64, y UInt64, z UInt64) ENGINE = MergeTree(d, (x, z), 1);
|
||||
CREATE TABLE mt_00160 (d Date DEFAULT toDate('2015-05-01'), x UInt64, y UInt64, z UInt64) ENGINE = MergeTree(d, (x, z), 1);
|
||||
|
||||
INSERT INTO test.mt_00160 (x, y, z) SELECT number AS x, number + 10 AS y, number / 2 AS z FROM system.numbers LIMIT 100000;
|
||||
INSERT INTO mt_00160 (x, y, z) SELECT number AS x, number + 10 AS y, number / 2 AS z FROM system.numbers LIMIT 100000;
|
||||
|
||||
SELECT *, b FROM test.mt_00160 WHERE (z, y, x) IN ((617, 1244, 1234), (2839, 5688, 5678), (1,1,1)) AND NOT ignore(blockSize() < 10 AS b) ORDER BY (x, y, z);
|
||||
SELECT *, b FROM mt_00160 WHERE (z, y, x) IN ((617, 1244, 1234), (2839, 5688, 5678), (1,1,1)) AND NOT ignore(blockSize() < 10 AS b) ORDER BY (x, y, z);
|
||||
|
||||
DROP TABLE test.mt_00160;
|
||||
DROP TABLE mt_00160;
|
||||
|
@ -1,12 +1,12 @@
|
||||
DROP TABLE IF EXISTS test.mt_00168;
|
||||
DROP TABLE IF EXISTS test.mt_00168_buffer;
|
||||
CREATE TABLE test.mt_00168 (EventDate Date, UTCEventTime DateTime, MoscowEventDate Date DEFAULT toDate(UTCEventTime)) ENGINE = MergeTree(EventDate, UTCEventTime, 8192);
|
||||
CREATE TABLE test.mt_00168_buffer AS test.mt_00168 ENGINE = Buffer(test, mt_00168, 16, 10, 100, 10000, 1000000, 10000000, 100000000);
|
||||
DESC TABLE test.mt_00168;
|
||||
DESC TABLE test.mt_00168_buffer;
|
||||
INSERT INTO test.mt_00168 (EventDate, UTCEventTime) VALUES ('2015-06-09', '2015-06-09 01:02:03');
|
||||
SELECT * FROM test.mt_00168_buffer;
|
||||
INSERT INTO test.mt_00168_buffer (EventDate, UTCEventTime) VALUES ('2015-06-09', '2015-06-09 01:02:03');
|
||||
SELECT * FROM test.mt_00168_buffer;
|
||||
DROP TABLE test.mt_00168_buffer;
|
||||
DROP TABLE test.mt_00168;
|
||||
DROP TABLE IF EXISTS mt_00168;
|
||||
DROP TABLE IF EXISTS mt_00168_buffer;
|
||||
CREATE TABLE mt_00168 (EventDate Date, UTCEventTime DateTime, MoscowEventDate Date DEFAULT toDate(UTCEventTime)) ENGINE = MergeTree(EventDate, UTCEventTime, 8192);
|
||||
CREATE TABLE mt_00168_buffer AS mt_00168 ENGINE = Buffer(test, mt_00168, 16, 10, 100, 10000, 1000000, 10000000, 100000000);
|
||||
DESC TABLE mt_00168;
|
||||
DESC TABLE mt_00168_buffer;
|
||||
INSERT INTO mt_00168 (EventDate, UTCEventTime) VALUES ('2015-06-09', '2015-06-09 01:02:03');
|
||||
SELECT * FROM mt_00168_buffer;
|
||||
INSERT INTO mt_00168_buffer (EventDate, UTCEventTime) VALUES ('2015-06-09', '2015-06-09 01:02:03');
|
||||
SELECT * FROM mt_00168_buffer;
|
||||
DROP TABLE mt_00168_buffer;
|
||||
DROP TABLE mt_00168;
|
||||
|
@ -22,3 +22,6 @@ INSERT INTO t2_00203 VALUES ('ccc', 4, 3, 2), ('ddd', 7, 6, 5);
|
||||
SELECT k1, k2, k3, val_t1, val_t2 FROM t1_00203 ANY FULL JOIN t2_00203 USING (k3, k1, k2 AS k2_alias) ORDER BY k1, k2, k3;
|
||||
|
||||
SELECT k1, k2, k3, val_t1, val_t2 FROM t1_00203 ANY RIGHT JOIN t2_00203 USING (k3, k1, k2 AS k2_alias) ORDER BY k1, k2, k3;
|
||||
|
||||
DROP TABLE t1_00203;
|
||||
DROP TABLE t2_00203;
|
||||
|
@ -1,7 +1,7 @@
|
||||
DROP TABLE IF EXISTS test.numbers_100k_log;
|
||||
CREATE TABLE test.numbers_100k_log ENGINE = Log AS SELECT * FROM system.numbers LIMIT 100000;
|
||||
DROP TABLE IF EXISTS numbers_100k_log;
|
||||
CREATE TABLE numbers_100k_log ENGINE = Log AS SELECT * FROM system.numbers LIMIT 100000;
|
||||
|
||||
SELECT count() = 200000 FROM remote('127.0.0.{2,3}', test.numbers_100k_log) GROUP BY number WITH TOTALS ORDER BY number LIMIT 10;
|
||||
SELECT count() = 200000 FROM remote('127.0.0.{2,3}', currentDatabase(), numbers_100k_log) GROUP BY number WITH TOTALS ORDER BY number LIMIT 10;
|
||||
|
||||
SET distributed_aggregation_memory_efficient = 1,
|
||||
group_by_two_level_threshold = 1000,
|
||||
@ -9,6 +9,6 @@ SET distributed_aggregation_memory_efficient = 1,
|
||||
max_rows_to_group_by = 1000,
|
||||
totals_mode = 'after_having_auto';
|
||||
|
||||
SELECT count() = 200000 FROM remote('127.0.0.{2,3}', test.numbers_100k_log) GROUP BY number WITH TOTALS ORDER BY number LIMIT 10;
|
||||
SELECT count() = 200000 FROM remote('127.0.0.{2,3}', currentDatabase(), numbers_100k_log) GROUP BY number WITH TOTALS ORDER BY number LIMIT 10;
|
||||
|
||||
DROP TABLE test.numbers_100k_log;
|
||||
DROP TABLE numbers_100k_log;
|
||||
|
@ -1,80 +1,80 @@
|
||||
set max_threads = 1;
|
||||
drop table if exists test.enums;
|
||||
drop table if exists enums;
|
||||
|
||||
create table test.enums (
|
||||
create table enums (
|
||||
d Date default '2015-12-29', k default 0,
|
||||
e Enum8('world' = 2, 'hello' = 1), sign Enum8('minus' = -1, 'plus' = 1),
|
||||
letter Enum16('a' = 0, 'b' = 1, 'c' = 2, '*' = -256)
|
||||
) engine = MergeTree(d, k, 1);
|
||||
|
||||
desc table test.enums;
|
||||
desc table enums;
|
||||
|
||||
-- insert default values
|
||||
insert into test.enums (k) values (0);
|
||||
select * from test.enums;
|
||||
insert into enums (k) values (0);
|
||||
select * from enums;
|
||||
|
||||
alter table test.enums modify column e Enum8('world' = 2, 'hello' = 1, '!' = 3);
|
||||
desc table test.enums;
|
||||
alter table enums modify column e Enum8('world' = 2, 'hello' = 1, '!' = 3);
|
||||
desc table enums;
|
||||
|
||||
insert into test.enums (e, sign, letter) values ('!', 'plus', 'b');
|
||||
select * from test.enums ORDER BY _part;
|
||||
insert into enums (e, sign, letter) values ('!', 'plus', 'b');
|
||||
select * from enums ORDER BY _part;
|
||||
|
||||
-- expand `e` and `sign` from Enum8 to Enum16 without changing values, change values of `letter` without changing type
|
||||
alter table test.enums
|
||||
alter table enums
|
||||
modify column e Enum16('world' = 2, 'hello' = 1, '!' = 3),
|
||||
modify column sign Enum16('minus' = -1, 'plus' = 1),
|
||||
modify column letter Enum16('a' = 0, 'b' = 1, 'c' = 2, 'no letter' = -256);
|
||||
desc table test.enums;
|
||||
desc table enums;
|
||||
|
||||
select * from test.enums ORDER BY _part;
|
||||
select * from enums ORDER BY _part;
|
||||
|
||||
alter table test.enums
|
||||
alter table enums
|
||||
modify column e Enum8('world' = 2, 'hello' = 1, '!' = 3),
|
||||
modify column sign Enum8('minus' = -1, 'plus' = 1);
|
||||
|
||||
desc table test.enums;
|
||||
desc table enums;
|
||||
|
||||
insert into test.enums (letter, e) values ('c', 'world');
|
||||
select * from test.enums ORDER BY _part;
|
||||
insert into enums (letter, e) values ('c', 'world');
|
||||
select * from enums ORDER BY _part;
|
||||
|
||||
drop table test.enums;
|
||||
drop table enums;
|
||||
|
||||
create table test.enums (e Enum8('a' = 0, 'b' = 1, 'c' = 2, 'd' = 3)) engine = TinyLog;
|
||||
insert into test.enums values ('d'), ('b'), ('a'), ('c'), ('a'), ('d');
|
||||
select * from test.enums;
|
||||
create table enums (e Enum8('a' = 0, 'b' = 1, 'c' = 2, 'd' = 3)) engine = TinyLog;
|
||||
insert into enums values ('d'), ('b'), ('a'), ('c'), ('a'), ('d');
|
||||
select * from enums;
|
||||
|
||||
-- ORDER BY
|
||||
select * from test.enums order by e;
|
||||
select * from test.enums order by e desc;
|
||||
select * from enums order by e;
|
||||
select * from enums order by e desc;
|
||||
|
||||
-- GROUP BY
|
||||
select count(), e from test.enums group by e;
|
||||
select any(e) from test.enums;
|
||||
select count(), e from enums group by e;
|
||||
select any(e) from enums;
|
||||
|
||||
-- IN
|
||||
select * from test.enums where e in ('a', 'd');
|
||||
select * from test.enums where e in (select e from test.enums);
|
||||
select * from enums where e in ('a', 'd');
|
||||
select * from enums where e in (select e from enums);
|
||||
|
||||
-- DISTINCT
|
||||
select distinct e from test.enums;
|
||||
select distinct e from enums;
|
||||
|
||||
-- Comparison
|
||||
select * from test.enums where e = e;
|
||||
select * from test.enums where e = 'a' or e = 'd';
|
||||
select * from test.enums where e != 'a';
|
||||
select *, e < 'b' from test.enums;
|
||||
select *, e > 'b' from test.enums;
|
||||
select * from enums where e = e;
|
||||
select * from enums where e = 'a' or e = 'd';
|
||||
select * from enums where e != 'a';
|
||||
select *, e < 'b' from enums;
|
||||
select *, e > 'b' from enums;
|
||||
|
||||
-- Conversion
|
||||
select toInt8(e), toInt16(e), toUInt64(e), toString(e), e from test.enums;
|
||||
select toInt8(e), toInt16(e), toUInt64(e), toString(e), e from enums;
|
||||
|
||||
drop table if exists test.enums_copy;
|
||||
create table test.enums_copy engine = TinyLog as select * from test.enums;
|
||||
select * from test.enums_copy;
|
||||
drop table if exists enums_copy;
|
||||
create table enums_copy engine = TinyLog as select * from enums;
|
||||
select * from enums_copy;
|
||||
|
||||
drop table test.enums_copy;
|
||||
create table test.enums_copy engine = TinyLog as select * from remote('127.0.0.2', test, enums);
|
||||
select * from remote('127.0.0.2', test, enums_copy);
|
||||
drop table enums_copy;
|
||||
create table enums_copy engine = TinyLog as select * from remote('127.0.0.2', currentDatabase(), enums);
|
||||
select * from remote('127.0.0.2', currentDatabase(), enums_copy);
|
||||
|
||||
drop table test.enums_copy;
|
||||
drop table test.enums;
|
||||
drop table enums_copy;
|
||||
drop table enums;
|
||||
|
@ -1,20 +1,20 @@
|
||||
DROP TABLE IF EXISTS test.sample_00314_1;
|
||||
DROP TABLE IF EXISTS test.sample_00314_2;
|
||||
DROP TABLE IF EXISTS test.sample_merge_00314;
|
||||
DROP TABLE IF EXISTS sample_00314_1;
|
||||
DROP TABLE IF EXISTS sample_00314_2;
|
||||
DROP TABLE IF EXISTS sample_merge_00314;
|
||||
|
||||
CREATE TABLE test.sample_00314_1 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
|
||||
CREATE TABLE test.sample_00314_2 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
|
||||
CREATE TABLE sample_00314_1 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
|
||||
CREATE TABLE sample_00314_2 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
|
||||
|
||||
SET min_insert_block_size_rows = 0, min_insert_block_size_bytes = 0;
|
||||
|
||||
INSERT INTO test.sample_00314_1 (x) SELECT number AS x FROM system.numbers LIMIT 1000000;
|
||||
INSERT INTO test.sample_00314_2 (x) SELECT number AS x FROM system.numbers LIMIT 2000000;
|
||||
INSERT INTO sample_00314_1 (x) SELECT number AS x FROM system.numbers LIMIT 1000000;
|
||||
INSERT INTO sample_00314_2 (x) SELECT number AS x FROM system.numbers LIMIT 2000000;
|
||||
|
||||
CREATE TABLE test.sample_merge_00314 AS test.sample_00314_1 ENGINE = Merge(test, '^sample_00314_\\d$');
|
||||
CREATE TABLE sample_merge_00314 AS sample_00314_1 ENGINE = Merge(currentDatabase(), '^sample_00314_\\d$');
|
||||
|
||||
SELECT abs(sum(_sample_factor) - 3000000) / 3000000 < 0.001 FROM test.sample_merge_00314 SAMPLE 100000;
|
||||
SELECT abs(sum(_sample_factor) - 3000000) / 3000000 < 0.001 FROM merge(test, '^sample_00314_\\d$') SAMPLE 100000;
|
||||
SELECT abs(sum(_sample_factor) - 3000000) / 3000000 < 0.001 FROM sample_merge_00314 SAMPLE 100000;
|
||||
SELECT abs(sum(_sample_factor) - 3000000) / 3000000 < 0.001 FROM merge(currentDatabase(), '^sample_00314_\\d$') SAMPLE 100000;
|
||||
|
||||
DROP TABLE test.sample_00314_1;
|
||||
DROP TABLE test.sample_00314_2;
|
||||
DROP TABLE test.sample_merge_00314;
|
||||
DROP TABLE sample_00314_1;
|
||||
DROP TABLE sample_00314_2;
|
||||
DROP TABLE sample_merge_00314;
|
||||
|
@ -1,12 +1,12 @@
|
||||
DROP TABLE IF EXISTS test.group_uniq_arr_int;
|
||||
CREATE TABLE test.group_uniq_arr_int ENGINE = Memory AS
|
||||
DROP TABLE IF EXISTS group_uniq_arr_int;
|
||||
CREATE TABLE group_uniq_arr_int ENGINE = Memory AS
|
||||
SELECT g as id, if(c == 0, [v], if(c == 1, emptyArrayInt64(), [v, v])) as v FROM
|
||||
(SELECT intDiv(number%1000000, 100) as v, intDiv(number%100, 10) as g, number%10 as c FROM system.numbers WHERE c < 3 LIMIT 10000000);
|
||||
|
||||
SELECT length(groupUniqArray(v)) FROM test.group_uniq_arr_int GROUP BY id ORDER BY id;
|
||||
SELECT length(groupUniqArray(v)) FROM remote('127.0.0.{2,3,4,5}', 'test', 'group_uniq_arr_int') GROUP BY id ORDER BY id;
|
||||
SELECT length(groupUniqArray(10)(v)) FROM test.group_uniq_arr_int GROUP BY id ORDER BY id;
|
||||
SELECT length(groupUniqArray(100000)(v)) FROM test.group_uniq_arr_int GROUP BY id ORDER BY id;
|
||||
SELECT length(groupUniqArray(v)) FROM group_uniq_arr_int GROUP BY id ORDER BY id;
|
||||
SELECT length(groupUniqArray(v)) FROM remote('127.0.0.{2,3,4,5}', currentDatabase(), 'group_uniq_arr_int') GROUP BY id ORDER BY id;
|
||||
SELECT length(groupUniqArray(10)(v)) FROM group_uniq_arr_int GROUP BY id ORDER BY id;
|
||||
SELECT length(groupUniqArray(100000)(v)) FROM group_uniq_arr_int GROUP BY id ORDER BY id;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS test.group_uniq_arr_int;
|
||||
DROP TABLE IF EXISTS group_uniq_arr_int;
|
||||
|
@ -1,9 +1,9 @@
|
||||
DROP TABLE IF EXISTS test.group_uniq_arr_str;
|
||||
CREATE TABLE test.group_uniq_arr_str ENGINE = Memory AS
|
||||
DROP TABLE IF EXISTS group_uniq_arr_str;
|
||||
CREATE TABLE group_uniq_arr_str ENGINE = Memory AS
|
||||
SELECT hex(intHash32(g)) as id, if(c == 0, [hex(v)], if(c == 1, emptyArrayString(), [hex(v), hex(v)])) as v FROM
|
||||
(SELECT intDiv(number%1000000, 100) as v, intDiv(number%100, 10) as g, number%10 as c FROM system.numbers WHERE c < 3 LIMIT 10000000);
|
||||
|
||||
SELECT length(groupUniqArray(v)) FROM test.group_uniq_arr_str GROUP BY id ORDER BY id;
|
||||
SELECT length(groupUniqArray(v)) FROM remote('127.0.0.{2,3,4,5}', 'test', 'group_uniq_arr_str') GROUP BY id ORDER BY id;
|
||||
SELECT length(groupUniqArray(v)) FROM group_uniq_arr_str GROUP BY id ORDER BY id;
|
||||
SELECT length(groupUniqArray(v)) FROM remote('127.0.0.{2,3,4,5}', currentDatabase(), 'group_uniq_arr_str') GROUP BY id ORDER BY id;
|
||||
|
||||
DROP TABLE IF EXISTS test.group_uniq_arr_str;
|
||||
DROP TABLE IF EXISTS group_uniq_arr_str;
|
||||
|
@ -40,3 +40,5 @@ SELECT cityHash64(groupArray(d)) FROM enum_pk WHERE d IN ('0', '1');
|
||||
|
||||
SELECT cityHash64(groupArray(x)) FROM enum_pk WHERE (x != '0' AND x != '1');
|
||||
SELECT cityHash64(groupArray(d)) FROM enum_pk WHERE (d != '0' AND d != '1');
|
||||
|
||||
DROP TABLE enum_pk;
|
||||
|
@ -1,23 +1,22 @@
|
||||
CREATE DATABASE IF NOT EXISTS test;
|
||||
DROP TABLE IF EXISTS test.has_column_in_table;
|
||||
CREATE TABLE test.has_column_in_table (i Int64, s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory;
|
||||
DROP TABLE IF EXISTS has_column_in_table;
|
||||
CREATE TABLE has_column_in_table (i Int64, s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory;
|
||||
|
||||
/* existing column */
|
||||
SELECT hasColumnInTable('test', 'has_column_in_table', 'i');
|
||||
SELECT hasColumnInTable('localhost', 'test', 'has_column_in_table', 'i');
|
||||
SELECT hasColumnInTable('test', 'has_column_in_table', 's');
|
||||
SELECT hasColumnInTable('localhost', 'test', 'has_column_in_table', 's');
|
||||
SELECT hasColumnInTable('test', 'has_column_in_table', 'nest.x');
|
||||
SELECT hasColumnInTable('localhost', 'test', 'has_column_in_table', 'nest.x');
|
||||
SELECT hasColumnInTable('test', 'has_column_in_table', 'nest.y');
|
||||
SELECT hasColumnInTable('localhost', 'test', 'has_column_in_table', 'nest.y');
|
||||
SELECT hasColumnInTable(currentDatabase(), 'has_column_in_table', 'i');
|
||||
SELECT hasColumnInTable('localhost', currentDatabase(), 'has_column_in_table', 'i');
|
||||
SELECT hasColumnInTable(currentDatabase(), 'has_column_in_table', 's');
|
||||
SELECT hasColumnInTable('localhost', currentDatabase(), 'has_column_in_table', 's');
|
||||
SELECT hasColumnInTable(currentDatabase(), 'has_column_in_table', 'nest.x');
|
||||
SELECT hasColumnInTable('localhost', currentDatabase(), 'has_column_in_table', 'nest.x');
|
||||
SELECT hasColumnInTable(currentDatabase(), 'has_column_in_table', 'nest.y');
|
||||
SELECT hasColumnInTable('localhost', currentDatabase(), 'has_column_in_table', 'nest.y');
|
||||
|
||||
/* not existing column */
|
||||
SELECT hasColumnInTable('test', 'has_column_in_table', 'nest');
|
||||
SELECT hasColumnInTable('localhost', 'test', 'has_column_in_table', 'nest');
|
||||
SELECT hasColumnInTable('test', 'has_column_in_table', 'nest.not_existing');
|
||||
SELECT hasColumnInTable('localhost', 'test', 'has_column_in_table', 'nest.not_existing');
|
||||
SELECT hasColumnInTable('test', 'has_column_in_table', 'not_existing');
|
||||
SELECT hasColumnInTable('localhost', 'test', 'has_column_in_table', 'not_existing');
|
||||
SELECT hasColumnInTable(currentDatabase(), 'has_column_in_table', 'nest');
|
||||
SELECT hasColumnInTable('localhost', currentDatabase(), 'has_column_in_table', 'nest');
|
||||
SELECT hasColumnInTable(currentDatabase(), 'has_column_in_table', 'nest.not_existing');
|
||||
SELECT hasColumnInTable('localhost', currentDatabase(), 'has_column_in_table', 'nest.not_existing');
|
||||
SELECT hasColumnInTable(currentDatabase(), 'has_column_in_table', 'not_existing');
|
||||
SELECT hasColumnInTable('localhost', currentDatabase(), 'has_column_in_table', 'not_existing');
|
||||
|
||||
DROP TABLE test.has_column_in_table;
|
||||
DROP TABLE has_column_in_table;
|
||||
|
@ -5,3 +5,4 @@ SET preferred_max_column_in_block_size_bytes = 32;
|
||||
SELECT blockSize(), * from tab_00481 format Null;
|
||||
SELECT 0;
|
||||
|
||||
DROP TABLE tab_00481;
|
||||
|
@ -32,3 +32,4 @@ insert into tab_00484 select today(), number, 'abc' from system.numbers limit 81
|
||||
set preferred_block_size_bytes = 0;
|
||||
select count(*) from tab_00484 prewhere s != 'abc' format Null;
|
||||
select count(*) from tab_00484 prewhere s = 'abc' format Null;
|
||||
drop table tab_00484;
|
||||
|
@ -1,8 +1,8 @@
|
||||
DROP TABLE IF EXISTS test.nested;
|
||||
CREATE TABLE test.nested (n Nested(x UInt8)) ENGINE = Memory;
|
||||
INSERT INTO test.nested VALUES ([1, 2]);
|
||||
SELECT 1 AS x FROM remote('127.0.0.2', test.nested) ARRAY JOIN n.x;
|
||||
DROP TABLE test.nested;
|
||||
DROP TABLE IF EXISTS nested;
|
||||
CREATE TABLE nested (n Nested(x UInt8)) ENGINE = Memory;
|
||||
INSERT INTO nested VALUES ([1, 2]);
|
||||
SELECT 1 AS x FROM remote('127.0.0.2', currentDatabase(), nested) ARRAY JOIN n.x;
|
||||
DROP TABLE nested;
|
||||
|
||||
SELECT dummy AS dummy, dummy AS b FROM system.one;
|
||||
SELECT dummy AS dummy, dummy AS b, b AS c FROM system.one;
|
||||
|
@ -1,109 +1,109 @@
|
||||
SELECT '*** Not partitioned ***';
|
||||
|
||||
DROP TABLE IF EXISTS test.not_partitioned;
|
||||
CREATE TABLE test.not_partitioned(x UInt8) ENGINE MergeTree ORDER BY x;
|
||||
DROP TABLE IF EXISTS not_partitioned;
|
||||
CREATE TABLE not_partitioned(x UInt8) ENGINE MergeTree ORDER BY x;
|
||||
|
||||
INSERT INTO test.not_partitioned VALUES (1), (2), (3);
|
||||
INSERT INTO test.not_partitioned VALUES (4), (5);
|
||||
INSERT INTO not_partitioned VALUES (1), (2), (3);
|
||||
INSERT INTO not_partitioned VALUES (4), (5);
|
||||
|
||||
SELECT 'Parts before OPTIMIZE:';
|
||||
SELECT partition, name FROM system.parts WHERE database = 'test' AND table = 'not_partitioned' AND active ORDER BY name;
|
||||
OPTIMIZE TABLE test.not_partitioned PARTITION tuple() FINAL;
|
||||
SELECT partition, name FROM system.parts WHERE database = currentDatabase() AND table = 'not_partitioned' AND active ORDER BY name;
|
||||
OPTIMIZE TABLE not_partitioned PARTITION tuple() FINAL;
|
||||
SELECT 'Parts after OPTIMIZE:';
|
||||
SELECT partition, name FROM system.parts WHERE database = 'test' AND table = 'not_partitioned' AND active ORDER BY name;
|
||||
SELECT partition, name FROM system.parts WHERE database = currentDatabase() AND table = 'not_partitioned' AND active ORDER BY name;
|
||||
|
||||
SELECT 'Sum before DETACH PARTITION:';
|
||||
SELECT sum(x) FROM test.not_partitioned;
|
||||
ALTER TABLE test.not_partitioned DETACH PARTITION ID 'all';
|
||||
SELECT sum(x) FROM not_partitioned;
|
||||
ALTER TABLE not_partitioned DETACH PARTITION ID 'all';
|
||||
SELECT 'Sum after DETACH PARTITION:';
|
||||
SELECT sum(x) FROM test.not_partitioned;
|
||||
SELECT sum(x) FROM not_partitioned;
|
||||
SELECT 'system.detached_parts after DETACH PARTITION:';
|
||||
SELECT * FROM system.detached_parts WHERE table = 'not_partitioned';
|
||||
|
||||
DROP TABLE test.not_partitioned;
|
||||
DROP TABLE not_partitioned;
|
||||
|
||||
SELECT '*** Partitioned by week ***';
|
||||
|
||||
DROP TABLE IF EXISTS test.partitioned_by_week;
|
||||
CREATE TABLE test.partitioned_by_week(d Date, x UInt8) ENGINE = MergeTree PARTITION BY toMonday(d) ORDER BY x;
|
||||
DROP TABLE IF EXISTS partitioned_by_week;
|
||||
CREATE TABLE partitioned_by_week(d Date, x UInt8) ENGINE = MergeTree PARTITION BY toMonday(d) ORDER BY x;
|
||||
|
||||
-- 2000-01-03 belongs to a different week than 2000-01-01 and 2000-01-02
|
||||
INSERT INTO test.partitioned_by_week VALUES ('2000-01-01', 1), ('2000-01-02', 2), ('2000-01-03', 3);
|
||||
INSERT INTO test.partitioned_by_week VALUES ('2000-01-03', 4), ('2000-01-03', 5);
|
||||
INSERT INTO partitioned_by_week VALUES ('2000-01-01', 1), ('2000-01-02', 2), ('2000-01-03', 3);
|
||||
INSERT INTO partitioned_by_week VALUES ('2000-01-03', 4), ('2000-01-03', 5);
|
||||
|
||||
SELECT 'Parts before OPTIMIZE:';
|
||||
SELECT partition, name FROM system.parts WHERE database = 'test' AND table = 'partitioned_by_week' AND active ORDER BY name;
|
||||
OPTIMIZE TABLE test.partitioned_by_week PARTITION '2000-01-03' FINAL;
|
||||
SELECT partition, name FROM system.parts WHERE database = currentDatabase() AND table = 'partitioned_by_week' AND active ORDER BY name;
|
||||
OPTIMIZE TABLE partitioned_by_week PARTITION '2000-01-03' FINAL;
|
||||
SELECT 'Parts after OPTIMIZE:';
|
||||
SELECT partition, name FROM system.parts WHERE database = 'test' AND table = 'partitioned_by_week' AND active ORDER BY name;
|
||||
SELECT partition, name FROM system.parts WHERE database = currentDatabase() AND table = 'partitioned_by_week' AND active ORDER BY name;
|
||||
|
||||
SELECT 'Sum before DROP PARTITION:';
|
||||
SELECT sum(x) FROM test.partitioned_by_week;
|
||||
ALTER TABLE test.partitioned_by_week DROP PARTITION '1999-12-27';
|
||||
SELECT sum(x) FROM partitioned_by_week;
|
||||
ALTER TABLE partitioned_by_week DROP PARTITION '1999-12-27';
|
||||
SELECT 'Sum after DROP PARTITION:';
|
||||
SELECT sum(x) FROM test.partitioned_by_week;
|
||||
SELECT sum(x) FROM partitioned_by_week;
|
||||
|
||||
DROP TABLE test.partitioned_by_week;
|
||||
DROP TABLE partitioned_by_week;
|
||||
|
||||
SELECT '*** Partitioned by a (Date, UInt8) tuple ***';
|
||||
|
||||
DROP TABLE IF EXISTS test.partitioned_by_tuple;
|
||||
CREATE TABLE test.partitioned_by_tuple(d Date, x UInt8, y UInt8) ENGINE MergeTree ORDER BY x PARTITION BY (d, x);
|
||||
DROP TABLE IF EXISTS partitioned_by_tuple;
|
||||
CREATE TABLE partitioned_by_tuple(d Date, x UInt8, y UInt8) ENGINE MergeTree ORDER BY x PARTITION BY (d, x);
|
||||
|
||||
INSERT INTO test.partitioned_by_tuple VALUES ('2000-01-01', 1, 1), ('2000-01-01', 2, 2), ('2000-01-02', 1, 3);
|
||||
INSERT INTO test.partitioned_by_tuple VALUES ('2000-01-02', 1, 4), ('2000-01-01', 1, 5);
|
||||
INSERT INTO partitioned_by_tuple VALUES ('2000-01-01', 1, 1), ('2000-01-01', 2, 2), ('2000-01-02', 1, 3);
|
||||
INSERT INTO partitioned_by_tuple VALUES ('2000-01-02', 1, 4), ('2000-01-01', 1, 5);
|
||||
|
||||
SELECT 'Parts before OPTIMIZE:';
|
||||
SELECT partition, name FROM system.parts WHERE database = 'test' AND table = 'partitioned_by_tuple' AND active ORDER BY name;
|
||||
OPTIMIZE TABLE test.partitioned_by_tuple PARTITION ('2000-01-01', 1) FINAL;
|
||||
OPTIMIZE TABLE test.partitioned_by_tuple PARTITION ('2000-01-02', 1) FINAL;
|
||||
SELECT partition, name FROM system.parts WHERE database = currentDatabase() AND table = 'partitioned_by_tuple' AND active ORDER BY name;
|
||||
OPTIMIZE TABLE partitioned_by_tuple PARTITION ('2000-01-01', 1) FINAL;
|
||||
OPTIMIZE TABLE partitioned_by_tuple PARTITION ('2000-01-02', 1) FINAL;
|
||||
SELECT 'Parts after OPTIMIZE:';
|
||||
SELECT partition, name FROM system.parts WHERE database = 'test' AND table = 'partitioned_by_tuple' AND active ORDER BY name;
|
||||
SELECT partition, name FROM system.parts WHERE database = currentDatabase() AND table = 'partitioned_by_tuple' AND active ORDER BY name;
|
||||
|
||||
SELECT 'Sum before DETACH PARTITION:';
|
||||
SELECT sum(y) FROM test.partitioned_by_tuple;
|
||||
ALTER TABLE test.partitioned_by_tuple DETACH PARTITION ID '20000101-1';
|
||||
SELECT sum(y) FROM partitioned_by_tuple;
|
||||
ALTER TABLE partitioned_by_tuple DETACH PARTITION ID '20000101-1';
|
||||
SELECT 'Sum after DETACH PARTITION:';
|
||||
SELECT sum(y) FROM test.partitioned_by_tuple;
|
||||
SELECT sum(y) FROM partitioned_by_tuple;
|
||||
|
||||
DROP TABLE test.partitioned_by_tuple;
|
||||
DROP TABLE partitioned_by_tuple;
|
||||
|
||||
SELECT '*** Partitioned by String ***';
|
||||
|
||||
DROP TABLE IF EXISTS test.partitioned_by_string;
|
||||
CREATE TABLE test.partitioned_by_string(s String, x UInt8) ENGINE = MergeTree PARTITION BY s ORDER BY x;
|
||||
DROP TABLE IF EXISTS partitioned_by_string;
|
||||
CREATE TABLE partitioned_by_string(s String, x UInt8) ENGINE = MergeTree PARTITION BY s ORDER BY x;
|
||||
|
||||
INSERT INTO test.partitioned_by_string VALUES ('aaa', 1), ('aaa', 2), ('bbb', 3);
|
||||
INSERT INTO test.partitioned_by_string VALUES ('bbb', 4), ('aaa', 5);
|
||||
INSERT INTO partitioned_by_string VALUES ('aaa', 1), ('aaa', 2), ('bbb', 3);
|
||||
INSERT INTO partitioned_by_string VALUES ('bbb', 4), ('aaa', 5);
|
||||
|
||||
SELECT 'Parts before OPTIMIZE:';
|
||||
SELECT partition, name FROM system.parts WHERE database = 'test' AND table = 'partitioned_by_string' AND active ORDER BY name;
|
||||
OPTIMIZE TABLE test.partitioned_by_string PARTITION 'aaa' FINAL;
|
||||
SELECT partition, name FROM system.parts WHERE database = currentDatabase() AND table = 'partitioned_by_string' AND active ORDER BY name;
|
||||
OPTIMIZE TABLE partitioned_by_string PARTITION 'aaa' FINAL;
|
||||
SELECT 'Parts after OPTIMIZE:';
|
||||
SELECT partition, name FROM system.parts WHERE database = 'test' AND table = 'partitioned_by_string' AND active ORDER BY name;
|
||||
SELECT partition, name FROM system.parts WHERE database = currentDatabase() AND table = 'partitioned_by_string' AND active ORDER BY name;
|
||||
|
||||
SELECT 'Sum before DROP PARTITION:';
|
||||
SELECT sum(x) FROM test.partitioned_by_string;
|
||||
ALTER TABLE test.partitioned_by_string DROP PARTITION 'bbb';
|
||||
SELECT sum(x) FROM partitioned_by_string;
|
||||
ALTER TABLE partitioned_by_string DROP PARTITION 'bbb';
|
||||
SELECT 'Sum after DROP PARTITION:';
|
||||
SELECT sum(x) FROM test.partitioned_by_string;
|
||||
SELECT sum(x) FROM partitioned_by_string;
|
||||
|
||||
DROP TABLE test.partitioned_by_string;
|
||||
DROP TABLE partitioned_by_string;
|
||||
|
||||
SELECT '*** Table without columns with fixed size ***';
|
||||
|
||||
DROP TABLE IF EXISTS test.without_fixed_size_columns;
|
||||
CREATE TABLE test.without_fixed_size_columns(s String) ENGINE MergeTree PARTITION BY length(s) ORDER BY s;
|
||||
DROP TABLE IF EXISTS without_fixed_size_columns;
|
||||
CREATE TABLE without_fixed_size_columns(s String) ENGINE MergeTree PARTITION BY length(s) ORDER BY s;
|
||||
|
||||
INSERT INTO test.without_fixed_size_columns VALUES ('a'), ('aa'), ('b'), ('cc');
|
||||
INSERT INTO without_fixed_size_columns VALUES ('a'), ('aa'), ('b'), ('cc');
|
||||
|
||||
SELECT 'Parts:';
|
||||
SELECT partition, name, rows FROM system.parts WHERE database = 'test' AND table = 'without_fixed_size_columns' AND active ORDER BY name;
|
||||
SELECT partition, name, rows FROM system.parts WHERE database = currentDatabase() AND table = 'without_fixed_size_columns' AND active ORDER BY name;
|
||||
|
||||
SELECT 'Before DROP PARTITION:';
|
||||
SELECT * FROM test.without_fixed_size_columns ORDER BY s;
|
||||
ALTER TABLE test.without_fixed_size_columns DROP PARTITION 1;
|
||||
SELECT * FROM without_fixed_size_columns ORDER BY s;
|
||||
ALTER TABLE without_fixed_size_columns DROP PARTITION 1;
|
||||
SELECT 'After DROP PARTITION:';
|
||||
SELECT * FROM test.without_fixed_size_columns ORDER BY s;
|
||||
SELECT * FROM without_fixed_size_columns ORDER BY s;
|
||||
|
||||
DROP TABLE test.without_fixed_size_columns;
|
||||
DROP TABLE without_fixed_size_columns;
|
||||
|
@ -1,58 +1,57 @@
|
||||
|
||||
SELECT X FROM (SELECT * FROM (SELECT 1 AS X, 2 AS Y) UNION ALL SELECT 3, 4) ORDER BY X;
|
||||
|
||||
DROP TABLE IF EXISTS test.globalin;
|
||||
DROP TABLE IF EXISTS globalin;
|
||||
|
||||
CREATE TABLE test.globalin (CounterID UInt32, StartDate Date ) ENGINE = Memory;
|
||||
CREATE TABLE globalin (CounterID UInt32, StartDate Date ) ENGINE = Memory;
|
||||
|
||||
INSERT INTO test.globalin VALUES (34, toDate('2017-10-02')), (42, toDate('2017-10-02')), (55, toDate('2017-10-01'));
|
||||
INSERT INTO globalin VALUES (34, toDate('2017-10-02')), (42, toDate('2017-10-02')), (55, toDate('2017-10-01'));
|
||||
|
||||
SELECT * FROM ( SELECT CounterID FROM remote('127.0.0.2', 'test', 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34))) GROUP BY CounterID);
|
||||
SELECT * FROM ( SELECT CounterID FROM remote('127.0.0.2', currentDatabase(), 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34))) GROUP BY CounterID);
|
||||
SELECT 'NOW okay =========================:';
|
||||
SELECT CounterID FROM remote('127.0.0.2', 'test', 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34) )) GROUP BY CounterID UNION ALL SELECT CounterID FROM remote('127.0.0.2', 'test', 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34))) GROUP BY CounterID;
|
||||
SELECT CounterID FROM remote('127.0.0.2', currentDatabase(), 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34) )) GROUP BY CounterID UNION ALL SELECT CounterID FROM remote('127.0.0.2', currentDatabase(), 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34))) GROUP BY CounterID;
|
||||
SELECT 'NOW BAD ==========================:';
|
||||
SELECT * FROM ( SELECT CounterID FROM remote('127.0.0.2', 'test', 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34) )) GROUP BY CounterID UNION ALL SELECT CounterID FROM remote('127.0.0.2', 'test', 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34))) GROUP BY CounterID);
|
||||
SELECT * FROM ( SELECT CounterID FROM remote('127.0.0.2', currentDatabase(), 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34) )) GROUP BY CounterID UNION ALL SELECT CounterID FROM remote('127.0.0.2', currentDatabase(), 'globalin') WHERE (CounterID GLOBAL IN ( SELECT toUInt32(34))) GROUP BY CounterID);
|
||||
SELECT 'finish ===========================;';
|
||||
|
||||
DROP TABLE test.globalin;
|
||||
DROP TABLE globalin;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS test.union_bug;
|
||||
DROP TABLE IF EXISTS union_bug;
|
||||
|
||||
CREATE TABLE test.union_bug (
|
||||
CREATE TABLE union_bug (
|
||||
Event String,
|
||||
Datetime DateTime('Europe/Moscow')
|
||||
) Engine = Memory;
|
||||
|
||||
INSERT INTO test.union_bug VALUES ('A', 1), ('B', 2);
|
||||
INSERT INTO union_bug VALUES ('A', 1), ('B', 2);
|
||||
|
||||
SELECT ' * A UNION * B:';
|
||||
SELECT * FROM (
|
||||
SELECT * FROM test.union_bug WHERE Event = 'A'
|
||||
SELECT * FROM union_bug WHERE Event = 'A'
|
||||
UNION ALL
|
||||
SELECT * FROM test.union_bug WHERE Event = 'B'
|
||||
SELECT * FROM union_bug WHERE Event = 'B'
|
||||
) ORDER BY Datetime;
|
||||
|
||||
SELECT ' Event, Datetime A UNION * B:';
|
||||
SELECT * FROM (
|
||||
SELECT Event, Datetime FROM test.union_bug WHERE Event = 'A'
|
||||
SELECT Event, Datetime FROM union_bug WHERE Event = 'A'
|
||||
UNION ALL
|
||||
SELECT * FROM test.union_bug WHERE Event = 'B'
|
||||
SELECT * FROM union_bug WHERE Event = 'B'
|
||||
) ORDER BY Datetime;
|
||||
|
||||
SELECT ' * A UNION Event, Datetime B:';
|
||||
SELECT * FROM (
|
||||
SELECT * FROM test.union_bug WHERE Event = 'A'
|
||||
SELECT * FROM union_bug WHERE Event = 'A'
|
||||
UNION ALL
|
||||
SELECT Event, Datetime FROM test.union_bug WHERE Event = 'B'
|
||||
SELECT Event, Datetime FROM union_bug WHERE Event = 'B'
|
||||
) ORDER BY Datetime;
|
||||
|
||||
SELECT ' Event, Datetime A UNION Event, Datetime B:';
|
||||
SELECT * FROM (
|
||||
SELECT Event, Datetime FROM test.union_bug WHERE Event = 'A'
|
||||
SELECT Event, Datetime FROM union_bug WHERE Event = 'A'
|
||||
UNION ALL
|
||||
SELECT Event, Datetime FROM test.union_bug WHERE Event = 'B'
|
||||
SELECT Event, Datetime FROM union_bug WHERE Event = 'B'
|
||||
) ORDER BY Datetime;
|
||||
|
||||
|
||||
DROP TABLE test.union_bug;
|
||||
DROP TABLE union_bug;
|
||||
|
@ -1,24 +1,24 @@
|
||||
|
||||
-- https://github.com/yandex/ClickHouse/issues/1059
|
||||
|
||||
DROP TABLE IF EXISTS test.union1;
|
||||
DROP TABLE IF EXISTS test.union2;
|
||||
DROP TABLE IF EXISTS test.union3;
|
||||
DROP TABLE IF EXISTS union1;
|
||||
DROP TABLE IF EXISTS union2;
|
||||
DROP TABLE IF EXISTS union3;
|
||||
|
||||
CREATE TABLE test.union1 ( date Date, a Int32, b Int32, c Int32, d Int32) ENGINE = MergeTree(date, (a, date), 8192);
|
||||
CREATE TABLE test.union2 ( date Date, a Int32, b Int32, c Int32, d Int32) ENGINE = Distributed(test_shard_localhost, 'test', 'union1');
|
||||
CREATE TABLE test.union3 ( date Date, a Int32, b Int32, c Int32, d Int32) ENGINE = Distributed(test_shard_localhost, 'test', 'union2');
|
||||
CREATE TABLE union1 ( date Date, a Int32, b Int32, c Int32, d Int32) ENGINE = MergeTree(date, (a, date), 8192);
|
||||
CREATE TABLE union2 ( date Date, a Int32, b Int32, c Int32, d Int32) ENGINE = Distributed(test_shard_localhost, currentDatabase(), 'union1');
|
||||
CREATE TABLE union3 ( date Date, a Int32, b Int32, c Int32, d Int32) ENGINE = Distributed(test_shard_localhost, currentDatabase(), 'union2');
|
||||
|
||||
INSERT INTO test.union1 VALUES (1, 2, 3, 4, 5);
|
||||
INSERT INTO test.union1 VALUES (11,12,13,14,15);
|
||||
INSERT INTO test.union2 VALUES (21,22,23,24,25);
|
||||
INSERT INTO test.union3 VALUES (31,32,33,34,35);
|
||||
INSERT INTO union1 VALUES (1, 2, 3, 4, 5);
|
||||
INSERT INTO union1 VALUES (11,12,13,14,15);
|
||||
INSERT INTO union2 VALUES (21,22,23,24,25);
|
||||
INSERT INTO union3 VALUES (31,32,33,34,35);
|
||||
|
||||
select b, sum(c) from ( select a, b, sum(c) as c from test.union2 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from test.union2 where b>1 group by a, b ) as a group by b;
|
||||
select b, sum(c) from ( select a, b, sum(c) as c from test.union1 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from test.union2 where b>1 group by a, b ) as a group by b;
|
||||
select b, sum(c) from ( select a, b, sum(c) as c from test.union1 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from test.union1 where b>1 group by a, b ) as a group by b;
|
||||
select b, sum(c) from ( select a, b, sum(c) as c from test.union2 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from test.union3 where b>1 group by a, b ) as a group by b;
|
||||
select b, sum(c) from ( select a, b, sum(c) as c from union2 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union2 where b>1 group by a, b ) as a group by b;
|
||||
select b, sum(c) from ( select a, b, sum(c) as c from union1 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union2 where b>1 group by a, b ) as a group by b;
|
||||
select b, sum(c) from ( select a, b, sum(c) as c from union1 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union1 where b>1 group by a, b ) as a group by b;
|
||||
select b, sum(c) from ( select a, b, sum(c) as c from union2 where a>1 group by a,b UNION ALL select a, b, sum(c) as c from union3 where b>1 group by a, b ) as a group by b;
|
||||
|
||||
DROP TABLE test.union1;
|
||||
DROP TABLE test.union2;
|
||||
DROP TABLE test.union3;
|
||||
DROP TABLE union1;
|
||||
DROP TABLE union2;
|
||||
DROP TABLE union3;
|
||||
|
@ -1,19 +1,19 @@
|
||||
DROP TABLE IF EXISTS test.nums;
|
||||
DROP TABLE IF EXISTS test.nums_buf;
|
||||
DROP TABLE IF EXISTS nums;
|
||||
DROP TABLE IF EXISTS nums_buf;
|
||||
|
||||
SET insert_allow_materialized_columns = 1;
|
||||
|
||||
CREATE TABLE test.nums ( n UInt64, m UInt64 MATERIALIZED n+1 ) ENGINE = Log;
|
||||
CREATE TABLE test.nums_buf AS test.nums ENGINE = Buffer(test, nums, 1, 10, 100, 1, 3, 10000000, 100000000);
|
||||
CREATE TABLE nums ( n UInt64, m UInt64 MATERIALIZED n+1 ) ENGINE = Log;
|
||||
CREATE TABLE nums_buf AS nums ENGINE = Buffer(currentDatabase(), nums, 1, 10, 100, 1, 3, 10000000, 100000000);
|
||||
|
||||
INSERT INTO test.nums_buf (n) VALUES (1);
|
||||
INSERT INTO test.nums_buf (n) VALUES (2);
|
||||
INSERT INTO test.nums_buf (n) VALUES (3);
|
||||
INSERT INTO test.nums_buf (n) VALUES (4);
|
||||
INSERT INTO test.nums_buf (n) VALUES (5);
|
||||
INSERT INTO nums_buf (n) VALUES (1);
|
||||
INSERT INTO nums_buf (n) VALUES (2);
|
||||
INSERT INTO nums_buf (n) VALUES (3);
|
||||
INSERT INTO nums_buf (n) VALUES (4);
|
||||
INSERT INTO nums_buf (n) VALUES (5);
|
||||
|
||||
SELECT n,m FROM test.nums ORDER BY n;
|
||||
SELECT n,m FROM test.nums_buf ORDER BY n;
|
||||
SELECT n,m FROM nums ORDER BY n;
|
||||
SELECT n,m FROM nums_buf ORDER BY n;
|
||||
|
||||
DROP TABLE IF EXISTS test.nums_buf;
|
||||
DROP TABLE IF EXISTS test.nums;
|
||||
DROP TABLE IF EXISTS nums_buf;
|
||||
DROP TABLE IF EXISTS nums;
|
||||
|
@ -1,8 +1,6 @@
|
||||
create database if not exists test;
|
||||
drop table if exists test.tab;
|
||||
create table test.tab (val UInt8) engine = MergeTree order by val;
|
||||
insert into function remote('127.0.0.2', test.tab) values (1);
|
||||
insert into function remote('127.0.0.{2|3}', test.tab) values (2);
|
||||
insert into function remote('127.0.0.{2|3|4}', test.tab) values (3);
|
||||
select * from test.tab order by val;
|
||||
|
||||
drop table if exists tab;
|
||||
create table tab (val UInt8) engine = MergeTree order by val;
|
||||
insert into function remote('127.0.0.2', currentDatabase(), tab) values (1);
|
||||
insert into function remote('127.0.0.{2|3}', currentDatabase(), tab) values (2);
|
||||
insert into function remote('127.0.0.{2|3|4}', currentDatabase(), tab) values (3);
|
||||
select * from tab order by val;
|
||||
|
@ -1,18 +1,18 @@
|
||||
DROP TABLE IF EXISTS test.sample_00579_1;
|
||||
DROP TABLE IF EXISTS test.sample_00579_2;
|
||||
DROP TABLE IF EXISTS test.sample_merge_00579;
|
||||
DROP TABLE IF EXISTS sample_00579_1;
|
||||
DROP TABLE IF EXISTS sample_00579_2;
|
||||
DROP TABLE IF EXISTS sample_merge_00579;
|
||||
|
||||
CREATE TABLE test.sample_00579_1 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
|
||||
CREATE TABLE test.sample_00579_2 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
|
||||
CREATE TABLE sample_00579_1 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
|
||||
CREATE TABLE sample_00579_2 (x UInt64, d Date DEFAULT today()) ENGINE = MergeTree(d, intHash64(x), intHash64(x), 10);
|
||||
|
||||
INSERT INTO test.sample_00579_1 (x) SELECT number AS x FROM system.numbers LIMIT 1000;
|
||||
INSERT INTO test.sample_00579_2 (x) SELECT number AS x FROM system.numbers LIMIT 2000;
|
||||
INSERT INTO sample_00579_1 (x) SELECT number AS x FROM system.numbers LIMIT 1000;
|
||||
INSERT INTO sample_00579_2 (x) SELECT number AS x FROM system.numbers LIMIT 2000;
|
||||
|
||||
CREATE TABLE test.sample_merge_00579 AS test.sample_00579_1 ENGINE = Merge(test, '^sample_00579_\\d$');
|
||||
CREATE TABLE sample_merge_00579 AS sample_00579_1 ENGINE = Merge(currentDatabase(), '^sample_00579_\\d$');
|
||||
|
||||
SET max_threads = 1;
|
||||
SELECT _sample_factor FROM merge(test, '^sample_00579_\\d$');
|
||||
SELECT _sample_factor FROM merge(currentDatabase(), '^sample_00579_\\d$');
|
||||
|
||||
DROP TABLE test.sample_00579_1;
|
||||
DROP TABLE test.sample_00579_2;
|
||||
DROP TABLE test.sample_merge_00579;
|
||||
DROP TABLE sample_00579_1;
|
||||
DROP TABLE sample_00579_2;
|
||||
DROP TABLE sample_merge_00579;
|
||||
|
@ -1,11 +1,11 @@
|
||||
DROP TABLE IF EXISTS test.local_statements;
|
||||
DROP TABLE IF EXISTS test.statements;
|
||||
DROP TABLE IF EXISTS local_statements;
|
||||
DROP TABLE IF EXISTS statements;
|
||||
|
||||
CREATE TABLE test.local_statements ( statementId String, eventDate Date, eventHour DateTime, eventTime DateTime, verb String, objectId String, onCourse UInt8, courseId UInt16, contextRegistration String, resultScoreRaw Float64, resultScoreMin Float64, resultScoreMax Float64, resultSuccess UInt8, resultCompletition UInt8, resultDuration UInt32, resultResponse String, learnerId String, learnerHash String, contextId UInt16) ENGINE = MergeTree ORDER BY tuple();
|
||||
CREATE TABLE local_statements ( statementId String, eventDate Date, eventHour DateTime, eventTime DateTime, verb String, objectId String, onCourse UInt8, courseId UInt16, contextRegistration String, resultScoreRaw Float64, resultScoreMin Float64, resultScoreMax Float64, resultSuccess UInt8, resultCompletition UInt8, resultDuration UInt32, resultResponse String, learnerId String, learnerHash String, contextId UInt16) ENGINE = MergeTree ORDER BY tuple();
|
||||
|
||||
CREATE TABLE test.statements ( statementId String, eventDate Date, eventHour DateTime, eventTime DateTime, verb String, objectId String, onCourse UInt8, courseId UInt16, contextRegistration String, resultScoreRaw Float64, resultScoreMin Float64, resultScoreMax Float64, resultSuccess UInt8, resultCompletition UInt8, resultDuration UInt32, resultResponse String, learnerId String, learnerHash String, contextId UInt16) ENGINE = Distributed(test_shard_localhost, 'test', 'local_statements', sipHash64(learnerHash));
|
||||
CREATE TABLE statements ( statementId String, eventDate Date, eventHour DateTime, eventTime DateTime, verb String, objectId String, onCourse UInt8, courseId UInt16, contextRegistration String, resultScoreRaw Float64, resultScoreMin Float64, resultScoreMax Float64, resultSuccess UInt8, resultCompletition UInt8, resultDuration UInt32, resultResponse String, learnerId String, learnerHash String, contextId UInt16) ENGINE = Distributed(test_shard_localhost, currentDatabase(), 'local_statements', sipHash64(learnerHash));
|
||||
|
||||
INSERT INTO test.local_statements FORMAT CSV "2b3b04ee-0bb8-4200-906f-d47c48e56bd0","2016-08-25","2016-08-25 14:00:00","2016-08-25 14:43:34","http://adlnet.gov/expapi/verbs/passed","https://crmm.ru/xapi/courses/spp/2/0/3/2/8",0,1,"c13d788c-26e0-40e3-bacb-a1ff78ee1518",100,0,0,0,0,0,"","https://sberbank-school.ru/xapi/accounts/userid/94312","6f696f938a69b5e173093718e1c2bbf2",0
|
||||
INSERT INTO local_statements FORMAT CSV "2b3b04ee-0bb8-4200-906f-d47c48e56bd0","2016-08-25","2016-08-25 14:00:00","2016-08-25 14:43:34","http://adlnet.gov/expapi/verbs/passed","https://crmm.ru/xapi/courses/spp/2/0/3/2/8",0,1,"c13d788c-26e0-40e3-bacb-a1ff78ee1518",100,0,0,0,0,0,"","https://sberbank-school.ru/xapi/accounts/userid/94312","6f696f938a69b5e173093718e1c2bbf2",0
|
||||
|
||||
SELECT avg(diff)
|
||||
FROM
|
||||
@ -16,7 +16,7 @@ FROM
|
||||
SELECT
|
||||
learnerHash,
|
||||
passed - eventTime AS diff
|
||||
FROM test.statements
|
||||
FROM statements
|
||||
GLOBAL ANY INNER JOIN
|
||||
(
|
||||
SELECT
|
||||
@ -28,7 +28,7 @@ FROM
|
||||
learnerHash,
|
||||
eventTime,
|
||||
resultScoreRaw
|
||||
FROM test.statements
|
||||
FROM statements
|
||||
WHERE (courseId = 1) AND (onCourse = 0)
|
||||
AND (verb = 'http://adlnet.gov/expapi/verbs/passed') AND (objectId = 'https://crmm.ru/xapi/courses/spp/1/1/0-1')
|
||||
ORDER BY eventTime ASC
|
||||
@ -44,5 +44,5 @@ FROM
|
||||
LIMIT 7, 126
|
||||
);
|
||||
|
||||
DROP TABLE test.local_statements;
|
||||
DROP TABLE test.statements;
|
||||
DROP TABLE local_statements;
|
||||
DROP TABLE statements;
|
||||
|
@ -1,7 +1,7 @@
|
||||
DROP TABLE IF EXISTS test.alias_local10;
|
||||
DROP TABLE IF EXISTS test.alias10;
|
||||
DROP TABLE IF EXISTS alias_local10;
|
||||
DROP TABLE IF EXISTS alias10;
|
||||
|
||||
CREATE TABLE test.alias_local10 (
|
||||
CREATE TABLE alias_local10 (
|
||||
Id Int8,
|
||||
EventDate Date DEFAULT '2000-01-01',
|
||||
field1 Int8,
|
||||
@ -9,52 +9,52 @@ CREATE TABLE test.alias_local10 (
|
||||
field3 ALIAS CASE WHEN field1 = 1 THEN field2 ELSE '0' END
|
||||
) ENGINE = MergeTree(EventDate, (Id, EventDate), 8192);
|
||||
|
||||
CREATE TABLE test.alias10 AS test.alias_local10 ENGINE = Distributed(test_shard_localhost, test, alias_local10, cityHash64(Id));
|
||||
CREATE TABLE alias10 AS alias_local10 ENGINE = Distributed(test_shard_localhost, currentDatabase(), alias_local10, cityHash64(Id));
|
||||
|
||||
INSERT INTO test.alias_local10 (Id, EventDate, field1, field2) VALUES (1, '2000-01-01', 1, '12345'), (2, '2000-01-01', 2, '54321'), (3, '2000-01-01', 0, '');
|
||||
INSERT INTO alias_local10 (Id, EventDate, field1, field2) VALUES (1, '2000-01-01', 1, '12345'), (2, '2000-01-01', 2, '54321'), (3, '2000-01-01', 0, '');
|
||||
|
||||
SELECT field1, field2, field3 FROM test.alias_local10;
|
||||
SELECT field1, field2, field3 FROM test.alias_local10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2 FROM test.alias_local10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2, field3 FROM alias_local10;
|
||||
SELECT field1, field2, field3 FROM alias_local10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2 FROM alias_local10 WHERE EventDate='2000-01-01';
|
||||
|
||||
SELECT field1, field2, field3 FROM test.alias10;
|
||||
SELECT field1, field2, field3 FROM test.alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2 FROM test.alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2, field3 FROM alias10;
|
||||
SELECT field1, field2, field3 FROM alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2 FROM alias10 WHERE EventDate='2000-01-01';
|
||||
|
||||
SELECT field2, field3 FROM test.alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field3 FROM test.alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field2, field3 FROM test.alias10;
|
||||
SELECT field3 FROM test.alias10;
|
||||
SELECT field2, field3 FROM alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field3 FROM alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field2, field3 FROM alias10;
|
||||
SELECT field3 FROM alias10;
|
||||
|
||||
SELECT field1 FROM test.alias10 WHERE field3 = '12345';
|
||||
SELECT field2 FROM test.alias10 WHERE field3 = '12345';
|
||||
SELECT field3 FROM test.alias10 WHERE field3 = '12345';
|
||||
SELECT field1 FROM alias10 WHERE field3 = '12345';
|
||||
SELECT field2 FROM alias10 WHERE field3 = '12345';
|
||||
SELECT field3 FROM alias10 WHERE field3 = '12345';
|
||||
|
||||
DROP TABLE test.alias10;
|
||||
CREATE TABLE test.alias10 (
|
||||
DROP TABLE alias10;
|
||||
CREATE TABLE alias10 (
|
||||
Id Int8,
|
||||
EventDate Date,
|
||||
field1 Int8,
|
||||
field2 String,
|
||||
field3 String
|
||||
) ENGINE = Distributed(test_shard_localhost, test, alias_local10);
|
||||
) ENGINE = Distributed(test_shard_localhost, currentDatabase(), alias_local10);
|
||||
|
||||
SELECT field1, field2, field3 FROM test.alias_local10;
|
||||
SELECT field1, field2, field3 FROM test.alias_local10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2 FROM test.alias_local10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2, field3 FROM alias_local10;
|
||||
SELECT field1, field2, field3 FROM alias_local10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2 FROM alias_local10 WHERE EventDate='2000-01-01';
|
||||
|
||||
SELECT field1, field2, field3 FROM test.alias10;
|
||||
SELECT field1, field2, field3 FROM test.alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2 FROM test.alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2, field3 FROM alias10;
|
||||
SELECT field1, field2, field3 FROM alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field1, field2 FROM alias10 WHERE EventDate='2000-01-01';
|
||||
|
||||
SELECT field2, field3 FROM test.alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field3 FROM test.alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field2, field3 FROM test.alias10;
|
||||
SELECT field3 FROM test.alias10;
|
||||
SELECT field2, field3 FROM alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field3 FROM alias10 WHERE EventDate='2000-01-01';
|
||||
SELECT field2, field3 FROM alias10;
|
||||
SELECT field3 FROM alias10;
|
||||
|
||||
SELECT field1 FROM test.alias10 WHERE field3 = '12345';
|
||||
SELECT field2 FROM test.alias10 WHERE field3 = '12345';
|
||||
SELECT field3 FROM test.alias10 WHERE field3 = '12345';
|
||||
SELECT field1 FROM alias10 WHERE field3 = '12345';
|
||||
SELECT field2 FROM alias10 WHERE field3 = '12345';
|
||||
SELECT field3 FROM alias10 WHERE field3 = '12345';
|
||||
|
||||
DROP TABLE test.alias_local10;
|
||||
DROP TABLE test.alias10;
|
||||
DROP TABLE alias_local10;
|
||||
DROP TABLE alias10;
|
||||
|
@ -1,2 +1,3 @@
|
||||
create database if not exists test;
|
||||
show create database test;
|
||||
create database if not exists test_00604;
|
||||
show create database test_00604;
|
||||
drop database test_00604;
|
||||
|
@ -42,3 +42,5 @@ drop table if exists tab_00612;
|
||||
CREATE TABLE tab_00612 (key1 Int32, id1 Int64, c1 Int64) ENGINE = MergeTree PARTITION BY id1 ORDER BY (key1) ;
|
||||
insert into tab_00612 values ( -1, 1, 0 );
|
||||
SELECT count(*) FROM tab_00612 PREWHERE id1 IN (1);
|
||||
|
||||
drop table tab_00612;
|
||||
|
@ -1,19 +1,19 @@
|
||||
drop table if exists test.test_in_tuple_1;
|
||||
drop table if exists test.test_in_tuple_2;
|
||||
drop table if exists test.test_in_tuple;
|
||||
drop table if exists test_in_tuple_1;
|
||||
drop table if exists test_in_tuple_2;
|
||||
drop table if exists test_in_tuple;
|
||||
|
||||
create table test.test_in_tuple_1 (key Int32, key_2 Int32, x Array(Int32), y Array(Int32)) engine = MergeTree order by (key, key_2);
|
||||
create table test.test_in_tuple_2 (key Int32, key_2 Int32, x Array(Int32), y Array(Int32)) engine = MergeTree order by (key, key_2);
|
||||
create table test.test_in_tuple as test.test_in_tuple_1 engine = Merge('test', '^test_in_tuple_[0-9]+$');
|
||||
create table test_in_tuple_1 (key Int32, key_2 Int32, x Array(Int32), y Array(Int32)) engine = MergeTree order by (key, key_2);
|
||||
create table test_in_tuple_2 (key Int32, key_2 Int32, x Array(Int32), y Array(Int32)) engine = MergeTree order by (key, key_2);
|
||||
create table test_in_tuple as test_in_tuple_1 engine = Merge(currentDatabase(), '^test_in_tuple_[0-9]+$');
|
||||
|
||||
insert into test.test_in_tuple_1 values (1, 1, [1, 2], [1, 2]);
|
||||
insert into test.test_in_tuple_2 values (2, 1, [1, 2], [1, 2]);
|
||||
select key, arr_x, arr_y, _table from test.test_in_tuple left array join x as arr_x, y as arr_y order by _table;
|
||||
insert into test_in_tuple_1 values (1, 1, [1, 2], [1, 2]);
|
||||
insert into test_in_tuple_2 values (2, 1, [1, 2], [1, 2]);
|
||||
select key, arr_x, arr_y, _table from test_in_tuple left array join x as arr_x, y as arr_y order by _table;
|
||||
select '-';
|
||||
select key, arr_x, arr_y, _table from test.test_in_tuple left array join x as arr_x, y as arr_y where (key_2, arr_x, arr_y) in (1, 1, 1) order by _table;
|
||||
select key, arr_x, arr_y, _table from test_in_tuple left array join x as arr_x, y as arr_y where (key_2, arr_x, arr_y) in (1, 1, 1) order by _table;
|
||||
select '-';
|
||||
select key, arr_x, arr_y, _table from test.test_in_tuple left array join arrayFilter((t, x_0, x_1) -> (key_2, x_0, x_1) in (1, 1, 1), x, x ,y) as arr_x, arrayFilter((t, x_0, x_1) -> (key_2, x_0, x_1) in (1, 1, 1), y, x ,y) as arr_y where (key_2, arr_x, arr_y) in (1, 1, 1) order by _table;
|
||||
select key, arr_x, arr_y, _table from test_in_tuple left array join arrayFilter((t, x_0, x_1) -> (key_2, x_0, x_1) in (1, 1, 1), x, x ,y) as arr_x, arrayFilter((t, x_0, x_1) -> (key_2, x_0, x_1) in (1, 1, 1), y, x ,y) as arr_y where (key_2, arr_x, arr_y) in (1, 1, 1) order by _table;
|
||||
|
||||
drop table if exists test.test_in_tuple_1;
|
||||
drop table if exists test.test_in_tuple_2;
|
||||
drop table if exists test.test_in_tuple;
|
||||
drop table if exists test_in_tuple_1;
|
||||
drop table if exists test_in_tuple_2;
|
||||
drop table if exists test_in_tuple;
|
||||
|
@ -1,8 +1,8 @@
|
||||
DROP TABLE IF EXISTS test.data;
|
||||
CREATE TABLE test.data (s String, x Int8, y Int8) ENGINE = MergeTree ORDER BY tuple();
|
||||
DROP TABLE IF EXISTS data;
|
||||
CREATE TABLE data (s String, x Int8, y Int8) ENGINE = MergeTree ORDER BY tuple();
|
||||
|
||||
INSERT INTO test.data VALUES ('hello', 0, 0), ('world', 0, 0), ('hello', 1, -1), ('world', -1, 1);
|
||||
INSERT INTO data VALUES ('hello', 0, 0), ('world', 0, 0), ('hello', 1, -1), ('world', -1, 1);
|
||||
|
||||
SELECT DISTINCT s FROM remote('127.0.0.{1,2}', test.data) ORDER BY x + y, s;
|
||||
SELECT DISTINCT s FROM remote('127.0.0.{1,2}', currentDatabase(), data) ORDER BY x + y, s;
|
||||
|
||||
DROP TABLE test.data;
|
||||
DROP TABLE data;
|
||||
|
@ -7,7 +7,7 @@ hello
|
||||
hello
|
||||
hello
|
||||
1970-01-01 00:00:01
|
||||
CREATE TABLE test.cast (`x` UInt8, `e` Enum8('hello' = 1, 'world' = 2) DEFAULT CAST(x, 'Enum8(\'hello\' = 1, \'world\' = 2)')) ENGINE = MergeTree ORDER BY e SETTINGS index_granularity = 8192
|
||||
CREATE TABLE default.cast (`x` UInt8, `e` Enum8('hello' = 1, 'world' = 2) DEFAULT CAST(x, 'Enum8(\'hello\' = 1, \'world\' = 2)')) ENGINE = MergeTree ORDER BY e SETTINGS index_granularity = 8192
|
||||
x UInt8
|
||||
e Enum8(\'hello\' = 1, \'world\' = 2) DEFAULT CAST(x, \'Enum8(\\\'hello\\\' = 1, \\\'world\\\' = 2)\')
|
||||
1 hello
|
||||
|
@ -17,8 +17,8 @@ SELECT cast(1, 'Enum8(\'hello\' = 1,\n\t\'world\' = 2)');
|
||||
|
||||
SELECT toTimeZone(CAST(1 AS TIMESTAMP), 'UTC');
|
||||
|
||||
DROP TABLE IF EXISTS test.cast;
|
||||
CREATE TABLE test.cast
|
||||
DROP TABLE IF EXISTS cast;
|
||||
CREATE TABLE cast
|
||||
(
|
||||
x UInt8,
|
||||
e Enum8
|
||||
@ -39,10 +39,10 @@ CREATE TABLE test.cast
|
||||
)
|
||||
) ENGINE = MergeTree ORDER BY e;
|
||||
|
||||
SHOW CREATE TABLE test.cast FORMAT TSVRaw;
|
||||
DESC TABLE test.cast;
|
||||
SHOW CREATE TABLE cast FORMAT TSVRaw;
|
||||
DESC TABLE cast;
|
||||
|
||||
INSERT INTO test.cast (x) VALUES (1);
|
||||
SELECT * FROM test.cast;
|
||||
INSERT INTO cast (x) VALUES (1);
|
||||
SELECT * FROM cast;
|
||||
|
||||
DROP TABLE test.cast;
|
||||
DROP TABLE cast;
|
||||
|
@ -2,3 +2,4 @@ drop table if exists `table_00653`;
|
||||
create table `table_00653` (val Int32) engine = MergeTree order by val;
|
||||
insert into `table_00653` values (-2), (0), (2);
|
||||
select count() from `table_00653` where toUInt64(val) == 0;
|
||||
drop table table_00653;
|
||||
|
@ -105,3 +105,8 @@ select a1, a2, b1, b2 from tab1 first any left join (select *, a2 as z from tab2
|
||||
select a1, a2, b1, b2 from tab1 first any left join (select *, a2 + 1 as z from tab2) second on first.b1 + 1 = second.z;
|
||||
select tab1.a1, a2, tab1.b1, second.b2 from tab1 first any left join (select * from tab2) second on first.b1 = second.a2;
|
||||
select a1, s.a1 from tab1 any left join (select * from tab1_copy) s on tab1.b1 + 3 = s.b1 + 2 FORMAT JSONEachRow;
|
||||
|
||||
drop table tab1;
|
||||
drop table tab1_copy;
|
||||
drop table tab2;
|
||||
drop table tab3;
|
||||
|
@ -1,7 +1,7 @@
|
||||
DROP TABLE IF EXISTS test.remote_test;
|
||||
CREATE TABLE test.remote_test(uid String, its UInt32, action_code String, day Date) ENGINE = MergeTree(day, (uid, its), 8192);
|
||||
INSERT INTO test.remote_test SELECT toString(number) AS uid, number % 3 AS its, toString(number % 3) AS action_code, '2000-01-01' FROM system.numbers LIMIT 10000;
|
||||
SELECT level, COUNT() FROM (SELECT uid, windowFunnel(3600)(toUInt32(its), action_code != '', action_code = '2') AS level FROM remote('127.0.0.{2,3}', test.remote_test) GROUP BY uid) GROUP BY level;
|
||||
SELECT level, COUNT() FROM (SELECT uid, windowFunnel(3600)(toUInt32(its), action_code != '', action_code = '2') AS level FROM remote('127.0.0.{2,3}', test.remote_test) GROUP BY uid) GROUP BY level;
|
||||
SELECT level, COUNT() FROM (SELECT uid, windowFunnel(3600)(toUInt32(its), action_code != '', action_code = '2') AS level FROM remote('127.0.0.{2,3}', test.remote_test) GROUP BY uid) GROUP BY level;
|
||||
DROP TABLE IF EXISTS test.remote_test;
|
||||
DROP TABLE IF EXISTS remote_test;
|
||||
CREATE TABLE remote_test(uid String, its UInt32, action_code String, day Date) ENGINE = MergeTree(day, (uid, its), 8192);
|
||||
INSERT INTO remote_test SELECT toString(number) AS uid, number % 3 AS its, toString(number % 3) AS action_code, '2000-01-01' FROM system.numbers LIMIT 10000;
|
||||
SELECT level, COUNT() FROM (SELECT uid, windowFunnel(3600)(toUInt32(its), action_code != '', action_code = '2') AS level FROM remote('127.0.0.{2,3}', currentDatabase(), remote_test) GROUP BY uid) GROUP BY level;
|
||||
SELECT level, COUNT() FROM (SELECT uid, windowFunnel(3600)(toUInt32(its), action_code != '', action_code = '2') AS level FROM remote('127.0.0.{2,3}', currentDatabase(), remote_test) GROUP BY uid) GROUP BY level;
|
||||
SELECT level, COUNT() FROM (SELECT uid, windowFunnel(3600)(toUInt32(its), action_code != '', action_code = '2') AS level FROM remote('127.0.0.{2,3}', currentDatabase(), remote_test) GROUP BY uid) GROUP BY level;
|
||||
DROP TABLE IF EXISTS remote_test;
|
||||
|
@ -90,6 +90,8 @@ SELECT covarSamp(a, a), covarSamp(b, b), covarSamp(c, c) FROM decimal; -- { serv
|
||||
SELECT corr(a, a), corr(b, b), corr(c, c) FROM decimal; -- { serverError 43 }
|
||||
SELECT 1 LIMIT 0;
|
||||
|
||||
DROP TABLE decimal;
|
||||
|
||||
-- TODO: sumMap
|
||||
-- TODO: other quantile(s)
|
||||
-- TODO: groupArray, groupArrayInsertAt, groupUniqArray
|
||||
|
@ -19,3 +19,5 @@ SELECT a, sum(s), count() from rollup GROUP BY ROLLUP(a) ORDER BY a;
|
||||
SELECT a, sum(s), count() from rollup GROUP BY a WITH ROLLUP ORDER BY a;
|
||||
|
||||
SELECT a, sum(s), count() from rollup GROUP BY a WITH ROLLUP WITH TOTALS ORDER BY a;
|
||||
|
||||
DROP TABLE rollup;
|
||||
|
@ -1,10 +1,10 @@
|
||||
DROP TEMPORARY TABLE IF EXISTS temporary_table;
|
||||
DROP TEMPORARY TABLE IF EXISTS test.test_merge_1;
|
||||
DROP TEMPORARY TABLE IF EXISTS test.test_merge_2;
|
||||
CREATE TABLE test.test_merge_1(id UInt64) ENGINE = Log;
|
||||
CREATE TABLE test.test_merge_2(id UInt64) ENGINE = Log;
|
||||
CREATE TEMPORARY TABLE temporary_table AS SELECT * FROM numbers(1) WHERE number NOT IN (SELECT id FROM merge('test', 'test_merge_1|test_merge_2'));
|
||||
DROP TEMPORARY TABLE IF EXISTS test_merge_1;
|
||||
DROP TEMPORARY TABLE IF EXISTS test_merge_2;
|
||||
CREATE TABLE test_merge_1(id UInt64) ENGINE = Log;
|
||||
CREATE TABLE test_merge_2(id UInt64) ENGINE = Log;
|
||||
CREATE TEMPORARY TABLE temporary_table AS SELECT * FROM numbers(1) WHERE number NOT IN (SELECT id FROM merge(currentDatabase(), 'test_merge_1|test_merge_2'));
|
||||
SELECT * FROM temporary_table;
|
||||
DROP TEMPORARY TABLE IF EXISTS temporary_table;
|
||||
DROP TEMPORARY TABLE IF EXISTS test.test_merge_1;
|
||||
DROP TEMPORARY TABLE IF EXISTS test.test_merge_2;
|
||||
DROP TEMPORARY TABLE IF EXISTS test_merge_1;
|
||||
DROP TEMPORARY TABLE IF EXISTS test_merge_2;
|
||||
|
@ -8,3 +8,6 @@ INSERT INTO default_join1 VALUES(1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO default_join2 VALUES(3, 3), (4, 4);
|
||||
|
||||
SELECT a, b FROM default_join1 JOIN (SELECT a, b FROM default_join2) USING a ORDER BY b SETTINGS join_default_strictness='ANY';
|
||||
|
||||
DROP TABLE default_join1;
|
||||
DROP TABLE default_join2;
|
||||
|
@ -1,88 +1,88 @@
|
||||
SET send_logs_level = 'none';
|
||||
|
||||
DROP TABLE IF EXISTS test.test_local_1;
|
||||
DROP TABLE IF EXISTS test.test_local_2;
|
||||
DROP TABLE IF EXISTS test.test_distributed_1;
|
||||
DROP TABLE IF EXISTS test.test_distributed_2;
|
||||
DROP TABLE IF EXISTS test_local_1;
|
||||
DROP TABLE IF EXISTS test_local_2;
|
||||
DROP TABLE IF EXISTS test_distributed_1;
|
||||
DROP TABLE IF EXISTS test_distributed_2;
|
||||
|
||||
CREATE TABLE test.test_local_1 (date Date, value UInt32) ENGINE = MergeTree(date, date, 8192);
|
||||
CREATE TABLE test.test_local_2 (date Date, value UInt32) ENGINE = MergeTree(date, date, 8192);
|
||||
CREATE TABLE test.test_distributed_1 AS test.test_local_1 ENGINE = Distributed('test_shard_localhost', 'test', test_local_1, rand());
|
||||
CREATE TABLE test.test_distributed_2 AS test.test_local_2 ENGINE = Distributed('test_shard_localhost', 'test', test_local_2, rand());
|
||||
CREATE TABLE test_local_1 (date Date, value UInt32) ENGINE = MergeTree(date, date, 8192);
|
||||
CREATE TABLE test_local_2 (date Date, value UInt32) ENGINE = MergeTree(date, date, 8192);
|
||||
CREATE TABLE test_distributed_1 AS test_local_1 ENGINE = Distributed('test_shard_localhost', currentDatabase(), test_local_1, rand());
|
||||
CREATE TABLE test_distributed_2 AS test_local_2 ENGINE = Distributed('test_shard_localhost', currentDatabase(), test_local_2, rand());
|
||||
|
||||
INSERT INTO test.test_local_1 VALUES ('2018-08-01',100);
|
||||
INSERT INTO test.test_local_2 VALUES ('2018-08-01',200);
|
||||
INSERT INTO test_local_1 VALUES ('2018-08-01',100);
|
||||
INSERT INTO test_local_2 VALUES ('2018-08-01',200);
|
||||
|
||||
SELECT '--------------Single Local------------';
|
||||
SELECT * FROM merge('test', 'test_local_1');
|
||||
SELECT *, _table FROM merge('test', 'test_local_1') ORDER BY _table;
|
||||
SELECT sum(value), _table FROM merge('test', 'test_local_1') GROUP BY _table ORDER BY _table;
|
||||
SELECT * FROM merge('test', 'test_local_1') WHERE _table = 'test_local_1';
|
||||
SELECT * FROM merge('test', 'test_local_1') PREWHERE _table = 'test_local_1'; -- { serverError 8 }
|
||||
SELECT * FROM merge('test', 'test_local_1') WHERE _table in ('test_local_1', 'test_local_2');
|
||||
SELECT * FROM merge('test', 'test_local_1') PREWHERE _table in ('test_local_1', 'test_local_2'); -- { serverError 8 }
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1');
|
||||
SELECT *, _table FROM merge(currentDatabase(), 'test_local_1') ORDER BY _table;
|
||||
SELECT sum(value), _table FROM merge(currentDatabase(), 'test_local_1') GROUP BY _table ORDER BY _table;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1') WHERE _table = 'test_local_1';
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1') PREWHERE _table = 'test_local_1'; -- { serverError 8 }
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1') WHERE _table in ('test_local_1', 'test_local_2');
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1') PREWHERE _table in ('test_local_1', 'test_local_2'); -- { serverError 8 }
|
||||
|
||||
SELECT '--------------Single Distributed------------';
|
||||
SELECT * FROM merge('test', 'test_distributed_1');
|
||||
SELECT *, _table FROM merge('test', 'test_distributed_1') ORDER BY _table;
|
||||
SELECT sum(value), _table FROM merge('test', 'test_distributed_1') GROUP BY _table ORDER BY _table;
|
||||
SELECT * FROM merge('test', 'test_distributed_1') WHERE _table = 'test_distributed_1';
|
||||
SELECT * FROM merge('test', 'test_distributed_1') PREWHERE _table = 'test_distributed_1';
|
||||
SELECT * FROM merge('test', 'test_distributed_1') WHERE _table in ('test_distributed_1', 'test_distributed_2');
|
||||
SELECT * FROM merge('test', 'test_distributed_1') PREWHERE _table in ('test_distributed_1', 'test_distributed_2');
|
||||
SELECT * FROM merge(currentDatabase(), 'test_distributed_1');
|
||||
SELECT *, _table FROM merge(currentDatabase(), 'test_distributed_1') ORDER BY _table;
|
||||
SELECT sum(value), _table FROM merge(currentDatabase(), 'test_distributed_1') GROUP BY _table ORDER BY _table;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_distributed_1') WHERE _table = 'test_distributed_1';
|
||||
SELECT * FROM merge(currentDatabase(), 'test_distributed_1') PREWHERE _table = 'test_distributed_1';
|
||||
SELECT * FROM merge(currentDatabase(), 'test_distributed_1') WHERE _table in ('test_distributed_1', 'test_distributed_2');
|
||||
SELECT * FROM merge(currentDatabase(), 'test_distributed_1') PREWHERE _table in ('test_distributed_1', 'test_distributed_2');
|
||||
|
||||
SELECT '--------------Local Merge Local------------';
|
||||
SELECT * FROM merge('test', 'test_local_1|test_local_2') ORDER BY _table;
|
||||
SELECT *, _table FROM merge('test', 'test_local_1|test_local_2') ORDER BY _table;
|
||||
SELECT sum(value), _table FROM merge('test', 'test_local_1|test_local_2') GROUP BY _table ORDER BY _table;
|
||||
SELECT * FROM merge('test', 'test_local_1|test_local_2') WHERE _table = 'test_local_1';
|
||||
SELECT * FROM merge('test', 'test_local_1|test_local_2') PREWHERE _table = 'test_local_1'; -- {serverError 8}
|
||||
SELECT * FROM merge('test', 'test_local_1|test_local_2') WHERE _table in ('test_local_1', 'test_local_2') ORDER BY value;
|
||||
SELECT * FROM merge('test', 'test_local_1|test_local_2') PREWHERE _table in ('test_local_1', 'test_local_2') ORDER BY value; -- {serverError 8}
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1|test_local_2') ORDER BY _table;
|
||||
SELECT *, _table FROM merge(currentDatabase(), 'test_local_1|test_local_2') ORDER BY _table;
|
||||
SELECT sum(value), _table FROM merge(currentDatabase(), 'test_local_1|test_local_2') GROUP BY _table ORDER BY _table;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1|test_local_2') WHERE _table = 'test_local_1';
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1|test_local_2') PREWHERE _table = 'test_local_1'; -- {serverError 8}
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1|test_local_2') WHERE _table in ('test_local_1', 'test_local_2') ORDER BY value;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1|test_local_2') PREWHERE _table in ('test_local_1', 'test_local_2') ORDER BY value; -- {serverError 8}
|
||||
|
||||
SELECT '--------------Local Merge Distributed------------';
|
||||
SELECT * FROM merge('test', 'test_local_1|test_distributed_2') ORDER BY _table;
|
||||
SELECT *, _table FROM merge('test', 'test_local_1|test_distributed_2') ORDER BY _table;
|
||||
SELECT sum(value), _table FROM merge('test', 'test_local_1|test_distributed_2') GROUP BY _table ORDER BY _table;
|
||||
SELECT * FROM merge('test', 'test_local_1|test_distributed_2') WHERE _table = 'test_local_1';
|
||||
SELECT * FROM merge('test', 'test_local_1|test_distributed_2') PREWHERE _table = 'test_local_1';
|
||||
SELECT * FROM merge('test', 'test_local_1|test_distributed_2') WHERE _table in ('test_local_1', 'test_distributed_2') ORDER BY value;
|
||||
SELECT * FROM merge('test', 'test_local_1|test_distributed_2') PREWHERE _table in ('test_local_1', 'test_distributed_2') ORDER BY value;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1|test_distributed_2') ORDER BY _table;
|
||||
SELECT *, _table FROM merge(currentDatabase(), 'test_local_1|test_distributed_2') ORDER BY _table;
|
||||
SELECT sum(value), _table FROM merge(currentDatabase(), 'test_local_1|test_distributed_2') GROUP BY _table ORDER BY _table;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1|test_distributed_2') WHERE _table = 'test_local_1';
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1|test_distributed_2') PREWHERE _table = 'test_local_1';
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1|test_distributed_2') WHERE _table in ('test_local_1', 'test_distributed_2') ORDER BY value;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_local_1|test_distributed_2') PREWHERE _table in ('test_local_1', 'test_distributed_2') ORDER BY value;
|
||||
|
||||
SELECT '--------------Distributed Merge Distributed------------';
|
||||
SELECT * FROM merge('test', 'test_distributed_1|test_distributed_2') ORDER BY _table;
|
||||
SELECT *, _table FROM merge('test', 'test_distributed_1|test_distributed_2') ORDER BY _table;
|
||||
SELECT sum(value), _table FROM merge('test', 'test_distributed_1|test_distributed_2') GROUP BY _table ORDER BY _table;
|
||||
SELECT * FROM merge('test', 'test_distributed_1|test_distributed_2') WHERE _table = 'test_distributed_1';
|
||||
SELECT * FROM merge('test', 'test_distributed_1|test_distributed_2') PREWHERE _table = 'test_distributed_1';
|
||||
SELECT * FROM merge('test', 'test_distributed_1|test_distributed_2') WHERE _table in ('test_distributed_1', 'test_distributed_2') ORDER BY value;
|
||||
SELECT * FROM merge('test', 'test_distributed_1|test_distributed_2') PREWHERE _table in ('test_distributed_1', 'test_distributed_2') ORDER BY value;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_distributed_1|test_distributed_2') ORDER BY _table;
|
||||
SELECT *, _table FROM merge(currentDatabase(), 'test_distributed_1|test_distributed_2') ORDER BY _table;
|
||||
SELECT sum(value), _table FROM merge(currentDatabase(), 'test_distributed_1|test_distributed_2') GROUP BY _table ORDER BY _table;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_distributed_1|test_distributed_2') WHERE _table = 'test_distributed_1';
|
||||
SELECT * FROM merge(currentDatabase(), 'test_distributed_1|test_distributed_2') PREWHERE _table = 'test_distributed_1';
|
||||
SELECT * FROM merge(currentDatabase(), 'test_distributed_1|test_distributed_2') WHERE _table in ('test_distributed_1', 'test_distributed_2') ORDER BY value;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_distributed_1|test_distributed_2') PREWHERE _table in ('test_distributed_1', 'test_distributed_2') ORDER BY value;
|
||||
|
||||
DROP TABLE IF EXISTS test.test_local_1;
|
||||
DROP TABLE IF EXISTS test.test_local_2;
|
||||
DROP TABLE IF EXISTS test.test_distributed_1;
|
||||
DROP TABLE IF EXISTS test.test_distributed_2;
|
||||
DROP TABLE IF EXISTS test_local_1;
|
||||
DROP TABLE IF EXISTS test_local_2;
|
||||
DROP TABLE IF EXISTS test_distributed_1;
|
||||
DROP TABLE IF EXISTS test_distributed_2;
|
||||
|
||||
DROP TABLE IF EXISTS test.test_u64_local;
|
||||
DROP TABLE IF EXISTS test.test_s64_local;
|
||||
DROP TABLE IF EXISTS test.test_u64_distributed;
|
||||
DROP TABLE IF EXISTS test.test_s64_distributed;
|
||||
DROP TABLE IF EXISTS test_u64_local;
|
||||
DROP TABLE IF EXISTS test_s64_local;
|
||||
DROP TABLE IF EXISTS test_u64_distributed;
|
||||
DROP TABLE IF EXISTS test_s64_distributed;
|
||||
|
||||
CREATE TABLE test.test_s64_local (date Date, value Int64) ENGINE = MergeTree(date, date, 8192);
|
||||
CREATE TABLE test.test_u64_local (date Date, value UInt64) ENGINE = MergeTree(date, date, 8192);
|
||||
CREATE TABLE test.test_s64_distributed AS test.test_s64_local ENGINE = Distributed('test_shard_localhost', 'test', test_s64_local, rand());
|
||||
CREATE TABLE test.test_u64_distributed AS test.test_u64_local ENGINE = Distributed('test_shard_localhost', 'test', test_u64_local, rand());
|
||||
CREATE TABLE test_s64_local (date Date, value Int64) ENGINE = MergeTree(date, date, 8192);
|
||||
CREATE TABLE test_u64_local (date Date, value UInt64) ENGINE = MergeTree(date, date, 8192);
|
||||
CREATE TABLE test_s64_distributed AS test_s64_local ENGINE = Distributed('test_shard_localhost', currentDatabase(), test_s64_local, rand());
|
||||
CREATE TABLE test_u64_distributed AS test_u64_local ENGINE = Distributed('test_shard_localhost', currentDatabase(), test_u64_local, rand());
|
||||
|
||||
INSERT INTO test.test_s64_local VALUES ('2018-08-01', -1);
|
||||
INSERT INTO test.test_u64_local VALUES ('2018-08-01', 1);
|
||||
INSERT INTO test_s64_local VALUES ('2018-08-01', -1);
|
||||
INSERT INTO test_u64_local VALUES ('2018-08-01', 1);
|
||||
|
||||
SELECT '--------------Implicit type conversion------------';
|
||||
SELECT * FROM merge('test', 'test_s64_distributed|test_u64_distributed') ORDER BY value;
|
||||
SELECT * FROM merge('test', 'test_s64_distributed|test_u64_distributed') WHERE date = '2018-08-01' ORDER BY value;
|
||||
SELECT * FROM merge('test', 'test_s64_distributed|test_u64_distributed') WHERE _table = 'test_u64_distributed' ORDER BY value;
|
||||
SELECT * FROM merge('test', 'test_s64_distributed|test_u64_distributed') WHERE value = 1; -- { serverError 171}
|
||||
SELECT * FROM merge(currentDatabase(), 'test_s64_distributed|test_u64_distributed') ORDER BY value;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_s64_distributed|test_u64_distributed') WHERE date = '2018-08-01' ORDER BY value;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_s64_distributed|test_u64_distributed') WHERE _table = 'test_u64_distributed' ORDER BY value;
|
||||
SELECT * FROM merge(currentDatabase(), 'test_s64_distributed|test_u64_distributed') WHERE value = 1; -- { serverError 171}
|
||||
|
||||
DROP TABLE IF EXISTS test.test_u64_local;
|
||||
DROP TABLE IF EXISTS test.test_s64_local;
|
||||
DROP TABLE IF EXISTS test.test_u64_distributed;
|
||||
DROP TABLE IF EXISTS test.test_s64_distributed;
|
||||
DROP TABLE IF EXISTS test_u64_local;
|
||||
DROP TABLE IF EXISTS test_s64_local;
|
||||
DROP TABLE IF EXISTS test_u64_distributed;
|
||||
DROP TABLE IF EXISTS test_s64_distributed;
|
||||
|
@ -1,4 +1,4 @@
|
||||
CREATE TABLE test.ipv4_test (`ipv4_` IPv4) ENGINE = Memory
|
||||
CREATE TABLE default.ipv4_test (`ipv4_` IPv4) ENGINE = Memory
|
||||
0.0.0.0 00
|
||||
8.8.8.8 08080808
|
||||
127.0.0.1 7F000001
|
||||
@ -10,7 +10,7 @@ CREATE TABLE test.ipv4_test (`ipv4_` IPv4) ENGINE = Memory
|
||||
> 127.0.0.1 255.255.255.255
|
||||
= 127.0.0.1 127.0.0.1
|
||||
euqality of IPv4-mapped IPv6 value and IPv4 promoted to IPv6 with function: 1
|
||||
CREATE TABLE test.ipv6_test (`ipv6_` IPv6) ENGINE = Memory
|
||||
CREATE TABLE default.ipv6_test (`ipv6_` IPv6) ENGINE = Memory
|
||||
:: 00000000000000000000000000000000
|
||||
:: 00000000000000000000000000000000
|
||||
::ffff:8.8.8.8 00000000000000000000FFFF08080808
|
||||
|
@ -1,59 +1,59 @@
|
||||
DROP TABLE IF EXISTS test.ipv4_test;
|
||||
DROP TABLE IF EXISTS ipv4_test;
|
||||
|
||||
-- Only valid values for IPv4
|
||||
CREATE TABLE test.ipv4_test (ipv4_ IPv4) ENGINE = Memory;
|
||||
CREATE TABLE ipv4_test (ipv4_ IPv4) ENGINE = Memory;
|
||||
|
||||
-- ipv4_ column shoud have type 'IPv4'
|
||||
SHOW CREATE TABLE test.ipv4_test;
|
||||
SHOW CREATE TABLE ipv4_test;
|
||||
|
||||
INSERT INTO test.ipv4_test (ipv4_) VALUES ('0.0.0.0'), ('255.255.255.255'), ('192.168.0.91'), ('127.0.0.1'), ('8.8.8.8');
|
||||
INSERT INTO ipv4_test (ipv4_) VALUES ('0.0.0.0'), ('255.255.255.255'), ('192.168.0.91'), ('127.0.0.1'), ('8.8.8.8');
|
||||
|
||||
SELECT ipv4_, hex(ipv4_) FROM test.ipv4_test ORDER BY ipv4_;
|
||||
SELECT ipv4_, hex(ipv4_) FROM ipv4_test ORDER BY ipv4_;
|
||||
|
||||
SELECT '< 127.0.0.1', ipv4_ FROM test.ipv4_test
|
||||
SELECT '< 127.0.0.1', ipv4_ FROM ipv4_test
|
||||
WHERE ipv4_ < toIPv4('127.0.0.1')
|
||||
ORDER BY ipv4_;
|
||||
|
||||
SELECT '> 127.0.0.1', ipv4_ FROM test.ipv4_test
|
||||
SELECT '> 127.0.0.1', ipv4_ FROM ipv4_test
|
||||
WHERE ipv4_ > toIPv4('127.0.0.1')
|
||||
ORDER BY ipv4_;
|
||||
|
||||
SELECT '= 127.0.0.1', ipv4_ FROM test.ipv4_test
|
||||
SELECT '= 127.0.0.1', ipv4_ FROM ipv4_test
|
||||
WHERE ipv4_ = toIPv4('127.0.0.1')
|
||||
ORDER BY ipv4_;
|
||||
|
||||
-- TODO: Assert that invalid values can't be inserted into IPv4 column.
|
||||
|
||||
DROP TABLE IF EXISTS test.ipv4_test;
|
||||
DROP TABLE IF EXISTS ipv4_test;
|
||||
|
||||
|
||||
select 'euqality of IPv4-mapped IPv6 value and IPv4 promoted to IPv6 with function:', toIPv6('::ffff:127.0.0.1') = IPv4ToIPv6(toIPv4('127.0.0.1'));
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS test.ipv6_test;
|
||||
DROP TABLE IF EXISTS ipv6_test;
|
||||
|
||||
-- Only valid values for IPv6
|
||||
CREATE TABLE test.ipv6_test (ipv6_ IPv6) ENGINE = Memory;
|
||||
CREATE TABLE ipv6_test (ipv6_ IPv6) ENGINE = Memory;
|
||||
|
||||
-- ipv6_ column shoud have type 'IPv6'
|
||||
SHOW CREATE TABLE test.ipv6_test;
|
||||
SHOW CREATE TABLE ipv6_test;
|
||||
|
||||
INSERT INTO test.ipv6_test VALUES ('::'), ('0:0:0:0:0:0:0:0'), ('FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF'), ('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D'), ('0000:0000:0000:0000:0000:FFFF:C1FC:110A'), ('::ffff:127.0.0.1'), ('::ffff:8.8.8.8');
|
||||
INSERT INTO ipv6_test VALUES ('::'), ('0:0:0:0:0:0:0:0'), ('FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF'), ('2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D'), ('0000:0000:0000:0000:0000:FFFF:C1FC:110A'), ('::ffff:127.0.0.1'), ('::ffff:8.8.8.8');
|
||||
|
||||
SELECT ipv6_, hex(ipv6_) FROM test.ipv6_test ORDER BY ipv6_;
|
||||
SELECT ipv6_, hex(ipv6_) FROM ipv6_test ORDER BY ipv6_;
|
||||
|
||||
SELECT '< 127.0.0.1', ipv6_ FROM test.ipv6_test
|
||||
SELECT '< 127.0.0.1', ipv6_ FROM ipv6_test
|
||||
WHERE ipv6_ < IPv4ToIPv6(toIPv4('127.0.0.1'))
|
||||
ORDER BY ipv6_;
|
||||
|
||||
SELECT '> 127.0.0.1', ipv6_ FROM test.ipv6_test
|
||||
SELECT '> 127.0.0.1', ipv6_ FROM ipv6_test
|
||||
WHERE ipv6_ > IPv4ToIPv6(toIPv4('127.0.0.1'))
|
||||
ORDER BY ipv6_;
|
||||
|
||||
SELECT '= 127.0.0.1', ipv6_ FROM test.ipv6_test
|
||||
SELECT '= 127.0.0.1', ipv6_ FROM ipv6_test
|
||||
WHERE ipv6_ = IPv4ToIPv6(toIPv4('127.0.0.1'))
|
||||
ORDER BY ipv6_;
|
||||
|
||||
-- TODO: Assert that invalid values can't be inserted into IPv6 column.
|
||||
|
||||
DROP TABLE IF EXISTS test.ipv6_test;
|
||||
DROP TABLE IF EXISTS ipv6_test;
|
||||
|
@ -4,3 +4,4 @@ CREATE TABLE or_expr_bug (a UInt64, b UInt64) ENGINE = Memory;
|
||||
INSERT INTO or_expr_bug VALUES(1,21),(1,22),(1,23),(2,21),(2,22),(2,23),(3,21),(3,22),(3,23);
|
||||
|
||||
SELECT count(*) FROM or_expr_bug WHERE (a=1 OR a=2 OR a=3) AND (b=21 OR b=22 OR b=23);
|
||||
DROP TABLE or_expr_bug;
|
||||
|
@ -1,32 +1,32 @@
|
||||
DROP TABLE IF EXISTS test.dst_00753;
|
||||
DROP TABLE IF EXISTS test.buffer_00753;
|
||||
DROP TABLE IF EXISTS dst_00753;
|
||||
DROP TABLE IF EXISTS buffer_00753;
|
||||
SET send_logs_level = 'error';
|
||||
|
||||
CREATE TABLE test.dst_00753 (x UInt64, y UInt64) ENGINE = MergeTree ORDER BY tuple();
|
||||
CREATE TABLE test.buffer_00753 (x UInt64, y UInt64) ENGINE = Buffer(test, dst_00753, 1, 99999, 99999, 1, 1, 99999, 99999);
|
||||
CREATE TABLE dst_00753 (x UInt64, y UInt64) ENGINE = MergeTree ORDER BY tuple();
|
||||
CREATE TABLE buffer_00753 (x UInt64, y UInt64) ENGINE = Buffer(currentDatabase(), dst_00753, 1, 99999, 99999, 1, 1, 99999, 99999);
|
||||
|
||||
INSERT INTO test.buffer_00753 VALUES (1, 100);
|
||||
INSERT INTO test.buffer_00753 VALUES (2, 200);
|
||||
INSERT INTO test.buffer_00753 VALUES (3, 300);
|
||||
INSERT INTO buffer_00753 VALUES (1, 100);
|
||||
INSERT INTO buffer_00753 VALUES (2, 200);
|
||||
INSERT INTO buffer_00753 VALUES (3, 300);
|
||||
SELECT 'init';
|
||||
SELECT * FROM test.dst_00753 ORDER BY x;
|
||||
SELECT * FROM dst_00753 ORDER BY x;
|
||||
SELECT '-';
|
||||
SELECT * FROM test.buffer_00753 ORDER BY x;
|
||||
SELECT * FROM buffer_00753 ORDER BY x;
|
||||
|
||||
ALTER TABLE test.dst_00753 DROP COLUMN x, MODIFY COLUMN y String, ADD COLUMN z String DEFAULT 'DEFZ';
|
||||
ALTER TABLE dst_00753 DROP COLUMN x, MODIFY COLUMN y String, ADD COLUMN z String DEFAULT 'DEFZ';
|
||||
|
||||
INSERT INTO test.buffer_00753 VALUES (4, 400);
|
||||
INSERT INTO buffer_00753 VALUES (4, 400);
|
||||
SELECT 'alt';
|
||||
SELECT * FROM test.dst_00753 ORDER BY y;
|
||||
SELECT * FROM dst_00753 ORDER BY y;
|
||||
SELECT '-';
|
||||
SELECT * FROM test.buffer_00753 ORDER BY y;
|
||||
SELECT * FROM buffer_00753 ORDER BY y;
|
||||
|
||||
OPTIMIZE TABLE test.buffer_00753;
|
||||
OPTIMIZE TABLE buffer_00753;
|
||||
SELECT 'opt';
|
||||
SELECT * FROM test.dst_00753 ORDER BY y;
|
||||
SELECT * FROM dst_00753 ORDER BY y;
|
||||
SELECT '-';
|
||||
SELECT * FROM test.buffer_00753 ORDER BY y;
|
||||
SELECT * FROM buffer_00753 ORDER BY y;
|
||||
|
||||
SET send_logs_level = 'warning';
|
||||
DROP TABLE IF EXISTS test.dst_00753;
|
||||
DROP TABLE IF EXISTS test.buffer_00753;
|
||||
DROP TABLE IF EXISTS dst_00753;
|
||||
DROP TABLE IF EXISTS buffer_00753;
|
||||
|
@ -1,5 +1,5 @@
|
||||
*** Check SHOW CREATE TABLE ***
|
||||
CREATE TABLE test.alter_column (`x` UInt32, `y` Int32) ENGINE = MergeTree PARTITION BY x ORDER BY x SETTINGS index_granularity = 8192
|
||||
CREATE TABLE default.alter_column (`x` UInt32, `y` Int32) ENGINE = MergeTree PARTITION BY x ORDER BY x SETTINGS index_granularity = 8192
|
||||
*** Check parts ***
|
||||
0 0
|
||||
10 -10
|
||||
@ -52,7 +52,7 @@ CREATE TABLE test.alter_column (`x` UInt32, `y` Int32) ENGINE = MergeTree PARTIT
|
||||
8 -8
|
||||
9 -9
|
||||
*** Check SHOW CREATE TABLE after ALTER MODIFY ***
|
||||
CREATE TABLE test.alter_column (`x` UInt32, `y` Int64) ENGINE = MergeTree PARTITION BY x ORDER BY x SETTINGS index_granularity = 8192
|
||||
CREATE TABLE default.alter_column (`x` UInt32, `y` Int64) ENGINE = MergeTree PARTITION BY x ORDER BY x SETTINGS index_granularity = 8192
|
||||
*** Check parts after ALTER MODIFY ***
|
||||
0 0
|
||||
10 -10
|
||||
|
@ -2,23 +2,23 @@
|
||||
|
||||
SET send_logs_level = 'none';
|
||||
|
||||
DROP TABLE IF EXISTS test.alter_column;
|
||||
DROP TABLE IF EXISTS alter_column;
|
||||
|
||||
CREATE TABLE test.alter_column(x UInt32, y Int32) ENGINE MergeTree PARTITION BY x ORDER BY x;
|
||||
INSERT INTO test.alter_column (x, y) SELECT number AS x, -number AS y FROM system.numbers LIMIT 50;
|
||||
CREATE TABLE alter_column(x UInt32, y Int32) ENGINE MergeTree PARTITION BY x ORDER BY x;
|
||||
INSERT INTO alter_column (x, y) SELECT number AS x, -number AS y FROM system.numbers LIMIT 50;
|
||||
|
||||
SELECT '*** Check SHOW CREATE TABLE ***';
|
||||
SHOW CREATE TABLE test.alter_column;
|
||||
SHOW CREATE TABLE alter_column;
|
||||
|
||||
SELECT '*** Check parts ***';
|
||||
SELECT * FROM test.alter_column ORDER BY _part;
|
||||
SELECT * FROM alter_column ORDER BY _part;
|
||||
|
||||
ALTER TABLE test.alter_column MODIFY COLUMN y Int64;
|
||||
ALTER TABLE alter_column MODIFY COLUMN y Int64;
|
||||
|
||||
SELECT '*** Check SHOW CREATE TABLE after ALTER MODIFY ***';
|
||||
SHOW CREATE TABLE test.alter_column;
|
||||
SHOW CREATE TABLE alter_column;
|
||||
|
||||
SELECT '*** Check parts after ALTER MODIFY ***';
|
||||
SELECT * FROM test.alter_column ORDER BY _part;
|
||||
SELECT * FROM alter_column ORDER BY _part;
|
||||
|
||||
DROP TABLE test.alter_column;
|
||||
DROP TABLE alter_column;
|
||||
|
@ -9,4 +9,4 @@
|
||||
1 2 1 30
|
||||
1 2 4 90
|
||||
*** Check SHOW CREATE TABLE ***
|
||||
CREATE TABLE test.summing (`x` UInt32, `y` UInt32, `z` UInt32, `val` UInt32) ENGINE = SummingMergeTree PRIMARY KEY (x, y) ORDER BY (x, y, -z) SETTINGS index_granularity = 8192
|
||||
CREATE TABLE default.summing (`x` UInt32, `y` UInt32, `z` UInt32, `val` UInt32) ENGINE = SummingMergeTree PRIMARY KEY (x, y) ORDER BY (x, y, -z) SETTINGS index_granularity = 8192
|
||||
|
@ -1,38 +1,38 @@
|
||||
SET send_logs_level = 'none';
|
||||
|
||||
DROP TABLE IF EXISTS test.old_style;
|
||||
CREATE TABLE test.old_style(d Date, x UInt32) ENGINE MergeTree(d, x, 8192);
|
||||
ALTER TABLE test.old_style ADD COLUMN y UInt32, MODIFY ORDER BY (x, y); -- { serverError 36}
|
||||
DROP TABLE test.old_style;
|
||||
DROP TABLE IF EXISTS old_style;
|
||||
CREATE TABLE old_style(d Date, x UInt32) ENGINE MergeTree(d, x, 8192);
|
||||
ALTER TABLE old_style ADD COLUMN y UInt32, MODIFY ORDER BY (x, y); -- { serverError 36}
|
||||
DROP TABLE old_style;
|
||||
|
||||
DROP TABLE IF EXISTS test.summing;
|
||||
CREATE TABLE test.summing(x UInt32, y UInt32, val UInt32) ENGINE SummingMergeTree ORDER BY (x, y);
|
||||
DROP TABLE IF EXISTS summing;
|
||||
CREATE TABLE summing(x UInt32, y UInt32, val UInt32) ENGINE SummingMergeTree ORDER BY (x, y);
|
||||
|
||||
/* Can't add an expression with existing column to ORDER BY. */
|
||||
ALTER TABLE test.summing MODIFY ORDER BY (x, y, -val); -- { serverError 36}
|
||||
ALTER TABLE summing MODIFY ORDER BY (x, y, -val); -- { serverError 36}
|
||||
|
||||
/* Can't add an expression with existing column to ORDER BY. */
|
||||
ALTER TABLE test.summing ADD COLUMN z UInt32 DEFAULT x + 1, MODIFY ORDER BY (x, y, -z); -- { serverError 36}
|
||||
ALTER TABLE summing ADD COLUMN z UInt32 DEFAULT x + 1, MODIFY ORDER BY (x, y, -z); -- { serverError 36}
|
||||
|
||||
/* Can't add nonexistent column to ORDER BY. */
|
||||
ALTER TABLE test.summing MODIFY ORDER BY (x, y, nonexistent); -- { serverError 47}
|
||||
ALTER TABLE summing MODIFY ORDER BY (x, y, nonexistent); -- { serverError 47}
|
||||
|
||||
/* Can't modyfy ORDER BY so that it is no longer a prefix of the PRIMARY KEY. */
|
||||
ALTER TABLE test.summing MODIFY ORDER BY x; -- { serverError 36}
|
||||
ALTER TABLE summing MODIFY ORDER BY x; -- { serverError 36}
|
||||
|
||||
INSERT INTO test.summing(x, y, val) VALUES (1, 2, 10), (1, 2, 20);
|
||||
INSERT INTO summing(x, y, val) VALUES (1, 2, 10), (1, 2, 20);
|
||||
|
||||
ALTER TABLE test.summing ADD COLUMN z UInt32 AFTER y, MODIFY ORDER BY (x, y, -z);
|
||||
ALTER TABLE summing ADD COLUMN z UInt32 AFTER y, MODIFY ORDER BY (x, y, -z);
|
||||
|
||||
INSERT INTO test.summing(x, y, z, val) values (1, 2, 1, 30), (1, 2, 2, 40), (1, 2, 2, 50);
|
||||
INSERT INTO summing(x, y, z, val) values (1, 2, 1, 30), (1, 2, 2, 40), (1, 2, 2, 50);
|
||||
|
||||
SELECT '*** Check that the parts are sorted according to the new key. ***';
|
||||
SELECT * FROM test.summing ORDER BY _part;
|
||||
SELECT * FROM summing ORDER BY _part;
|
||||
|
||||
SELECT '*** Check that the rows are collapsed according to the new key. ***';
|
||||
SELECT * FROM test.summing FINAL ORDER BY x, y, z;
|
||||
SELECT * FROM summing FINAL ORDER BY x, y, z;
|
||||
|
||||
SELECT '*** Check SHOW CREATE TABLE ***';
|
||||
SHOW CREATE TABLE test.summing;
|
||||
SHOW CREATE TABLE summing;
|
||||
|
||||
DROP TABLE test.summing;
|
||||
DROP TABLE summing;
|
||||
|
@ -1,8 +1,7 @@
|
||||
drop table if exists test.t;
|
||||
drop table if exists test.td;
|
||||
create table test.t (val UInt32) engine = MergeTree order by val;
|
||||
create table test.td engine = Distributed(test_shard_localhost, 'test', 't') as test.t;
|
||||
select engine from system.tables where database = 'test' and name = 'td';
|
||||
drop table if exists test.t;
|
||||
drop table if exists test.td;
|
||||
|
||||
drop table if exists t;
|
||||
drop table if exists td;
|
||||
create table t (val UInt32) engine = MergeTree order by val;
|
||||
create table td engine = Distributed(test_shard_localhost, currentDatabase(), 't') as t;
|
||||
select engine from system.tables where database = currentDatabase() and name = 'td';
|
||||
drop table if exists t;
|
||||
drop table if exists td;
|
||||
|
@ -1,11 +1,11 @@
|
||||
DROP TABLE IF EXISTS test.low_cardinality;
|
||||
DROP TABLE IF EXISTS test.low_cardinality_all;
|
||||
DROP TABLE IF EXISTS low_cardinality;
|
||||
DROP TABLE IF EXISTS low_cardinality_all;
|
||||
|
||||
CREATE TABLE test.low_cardinality (d Date, x UInt32, s LowCardinality(String)) ENGINE = MergeTree(d, x, 8192);
|
||||
CREATE TABLE test.low_cardinality_all (d Date, x UInt32, s LowCardinality(String)) ENGINE = Distributed(test_shard_localhost, test, low_cardinality, sipHash64(s));
|
||||
CREATE TABLE low_cardinality (d Date, x UInt32, s LowCardinality(String)) ENGINE = MergeTree(d, x, 8192);
|
||||
CREATE TABLE low_cardinality_all (d Date, x UInt32, s LowCardinality(String)) ENGINE = Distributed(test_shard_localhost, currentDatabase(), low_cardinality, sipHash64(s));
|
||||
|
||||
INSERT INTO test.low_cardinality_all (d,x,s) VALUES ('2018-11-12',1,'123');
|
||||
SELECT s FROM test.low_cardinality_all;
|
||||
INSERT INTO low_cardinality_all (d,x,s) VALUES ('2018-11-12',1,'123');
|
||||
SELECT s FROM low_cardinality_all;
|
||||
|
||||
DROP TABLE IF EXISTS test.low_cardinality;
|
||||
DROP TABLE IF EXISTS test.low_cardinality_all;
|
||||
DROP TABLE IF EXISTS low_cardinality;
|
||||
DROP TABLE IF EXISTS low_cardinality_all;
|
||||
|
@ -1,8 +1,7 @@
|
||||
CREATE DATABASE IF NOT EXISTS test;
|
||||
DROP TABLE IF EXISTS test.datetime_table;
|
||||
DROP TABLE IF EXISTS datetime_table;
|
||||
|
||||
-- Create a table with DateTime column, but not used in partition key
|
||||
CREATE TABLE test.datetime_table
|
||||
CREATE TABLE datetime_table
|
||||
(
|
||||
t DateTime,
|
||||
name String,
|
||||
@ -11,23 +10,23 @@ CREATE TABLE test.datetime_table
|
||||
ORDER BY (t, name)
|
||||
PARTITION BY value;
|
||||
|
||||
INSERT INTO test.datetime_table VALUES (toDateTime('2016-01-01 00:00:00'),'name1',2);
|
||||
INSERT INTO test.datetime_table VALUES (toDateTime('2016-01-02 00:00:00'),'name2',2);
|
||||
INSERT INTO test.datetime_table VALUES (toDateTime('2016-01-03 00:00:00'),'name1',4);
|
||||
INSERT INTO datetime_table VALUES (toDateTime('2016-01-01 00:00:00'),'name1',2);
|
||||
INSERT INTO datetime_table VALUES (toDateTime('2016-01-02 00:00:00'),'name2',2);
|
||||
INSERT INTO datetime_table VALUES (toDateTime('2016-01-03 00:00:00'),'name1',4);
|
||||
|
||||
-- min_time and max_time are not filled
|
||||
|
||||
SELECT partition, MIN(min_time) as min_time, MAX(max_time) as max_time
|
||||
FROM system.parts
|
||||
WHERE database = 'test' and table = 'datetime_table' AND active = 1
|
||||
WHERE database = currentDatabase() and table = 'datetime_table' AND active = 1
|
||||
GROUP BY partition
|
||||
ORDER BY partition ASC
|
||||
FORMAT CSV;
|
||||
|
||||
DROP TABLE IF EXISTS test.datetime_table;
|
||||
DROP TABLE IF EXISTS datetime_table;
|
||||
|
||||
-- Create a table with DateTime column, this time used in partition key
|
||||
CREATE TABLE test.datetime_table
|
||||
CREATE TABLE datetime_table
|
||||
(
|
||||
t DateTime,
|
||||
name String,
|
||||
@ -36,25 +35,25 @@ CREATE TABLE test.datetime_table
|
||||
ORDER BY (t, name)
|
||||
PARTITION BY toStartOfDay(t);
|
||||
|
||||
INSERT INTO test.datetime_table VALUES (toDateTime('2016-01-01 00:00:00'),'name1',2);
|
||||
INSERT INTO test.datetime_table VALUES (toDateTime('2016-01-01 02:00:00'),'name1',3);
|
||||
INSERT INTO test.datetime_table VALUES (toDateTime('2016-01-02 01:00:00'),'name2',2);
|
||||
INSERT INTO test.datetime_table VALUES (toDateTime('2016-01-02 23:00:00'),'name2',5);
|
||||
INSERT INTO test.datetime_table VALUES (toDateTime('2016-01-03 04:00:00'),'name1',4);
|
||||
INSERT INTO datetime_table VALUES (toDateTime('2016-01-01 00:00:00'),'name1',2);
|
||||
INSERT INTO datetime_table VALUES (toDateTime('2016-01-01 02:00:00'),'name1',3);
|
||||
INSERT INTO datetime_table VALUES (toDateTime('2016-01-02 01:00:00'),'name2',2);
|
||||
INSERT INTO datetime_table VALUES (toDateTime('2016-01-02 23:00:00'),'name2',5);
|
||||
INSERT INTO datetime_table VALUES (toDateTime('2016-01-03 04:00:00'),'name1',4);
|
||||
|
||||
-- min_time and max_time are now filled
|
||||
|
||||
SELECT partition, MIN(min_time) as min_time, MAX(max_time) as max_time
|
||||
FROM system.parts
|
||||
WHERE database = 'test' and table = 'datetime_table' AND active = 1
|
||||
WHERE database = currentDatabase() and table = 'datetime_table' AND active = 1
|
||||
GROUP BY partition
|
||||
ORDER BY partition ASC
|
||||
FORMAT CSV;
|
||||
|
||||
DROP TABLE IF EXISTS test.datetime_table;
|
||||
DROP TABLE IF EXISTS datetime_table;
|
||||
|
||||
-- Create a table with DateTime column, this time used in partition key, but not at the first level
|
||||
CREATE TABLE test.datetime_table
|
||||
CREATE TABLE datetime_table
|
||||
(
|
||||
t DateTime,
|
||||
name String,
|
||||
@ -65,19 +64,19 @@ CREATE TABLE test.datetime_table
|
||||
|
||||
-- We are using a daily aggregation that is independant of the timezone, add data also
|
||||
|
||||
INSERT INTO test.datetime_table VALUES (1451606400,'name1',2);
|
||||
INSERT INTO test.datetime_table VALUES (1451613600,'name1',3);
|
||||
INSERT INTO test.datetime_table VALUES (1451696400,'name2',2);
|
||||
INSERT INTO test.datetime_table VALUES (1451775600,'name2',5);
|
||||
INSERT INTO test.datetime_table VALUES (1451793600,'name1',4);
|
||||
INSERT INTO datetime_table VALUES (1451606400,'name1',2);
|
||||
INSERT INTO datetime_table VALUES (1451613600,'name1',3);
|
||||
INSERT INTO datetime_table VALUES (1451696400,'name2',2);
|
||||
INSERT INTO datetime_table VALUES (1451775600,'name2',5);
|
||||
INSERT INTO datetime_table VALUES (1451793600,'name1',4);
|
||||
|
||||
-- min_time and max_time are now filled
|
||||
|
||||
SELECT partition, toUnixTimestamp(MIN(min_time)) as min_unix_time, toUnixTimestamp(MAX(max_time)) as max_unix_time
|
||||
FROM system.parts
|
||||
WHERE database = 'test' and table = 'datetime_table' AND active = 1
|
||||
WHERE database = currentDatabase() and table = 'datetime_table' AND active = 1
|
||||
GROUP BY partition
|
||||
ORDER BY partition ASC
|
||||
FORMAT CSV;
|
||||
|
||||
DROP TABLE IF EXISTS test.datetime_table;
|
||||
DROP TABLE IF EXISTS datetime_table;
|
||||
|
@ -1,88 +1,88 @@
|
||||
SET send_logs_level = 'none';
|
||||
|
||||
DROP TABLE IF EXISTS test.alter_compression_codec;
|
||||
DROP TABLE IF EXISTS alter_compression_codec;
|
||||
|
||||
CREATE TABLE test.alter_compression_codec (
|
||||
CREATE TABLE alter_compression_codec (
|
||||
somedate Date CODEC(LZ4),
|
||||
id UInt64 CODEC(NONE)
|
||||
) ENGINE = MergeTree() PARTITION BY somedate ORDER BY id;
|
||||
|
||||
INSERT INTO test.alter_compression_codec VALUES('2018-01-01', 1);
|
||||
INSERT INTO test.alter_compression_codec VALUES('2018-01-01', 2);
|
||||
SELECT * FROM test.alter_compression_codec ORDER BY id;
|
||||
INSERT INTO alter_compression_codec VALUES('2018-01-01', 1);
|
||||
INSERT INTO alter_compression_codec VALUES('2018-01-01', 2);
|
||||
SELECT * FROM alter_compression_codec ORDER BY id;
|
||||
|
||||
ALTER TABLE test.alter_compression_codec ADD COLUMN alter_column String DEFAULT 'default_value' CODEC(ZSTD);
|
||||
SELECT compression_codec FROM system.columns WHERE database = 'test' AND table = 'alter_compression_codec' AND name = 'alter_column';
|
||||
ALTER TABLE alter_compression_codec ADD COLUMN alter_column String DEFAULT 'default_value' CODEC(ZSTD);
|
||||
SELECT compression_codec FROM system.columns WHERE database = currentDatabase() AND table = 'alter_compression_codec' AND name = 'alter_column';
|
||||
|
||||
INSERT INTO test.alter_compression_codec VALUES('2018-01-01', 3, '3');
|
||||
INSERT INTO test.alter_compression_codec VALUES('2018-01-01', 4, '4');
|
||||
SELECT * FROM test.alter_compression_codec ORDER BY id;
|
||||
INSERT INTO alter_compression_codec VALUES('2018-01-01', 3, '3');
|
||||
INSERT INTO alter_compression_codec VALUES('2018-01-01', 4, '4');
|
||||
SELECT * FROM alter_compression_codec ORDER BY id;
|
||||
|
||||
ALTER TABLE test.alter_compression_codec MODIFY COLUMN alter_column CODEC(NONE);
|
||||
SELECT compression_codec FROM system.columns WHERE database = 'test' AND table = 'alter_compression_codec' AND name = 'alter_column';
|
||||
ALTER TABLE alter_compression_codec MODIFY COLUMN alter_column CODEC(NONE);
|
||||
SELECT compression_codec FROM system.columns WHERE database = currentDatabase() AND table = 'alter_compression_codec' AND name = 'alter_column';
|
||||
|
||||
INSERT INTO test.alter_compression_codec VALUES('2018-01-01', 5, '5');
|
||||
INSERT INTO test.alter_compression_codec VALUES('2018-01-01', 6, '6');
|
||||
SELECT * FROM test.alter_compression_codec ORDER BY id;
|
||||
INSERT INTO alter_compression_codec VALUES('2018-01-01', 5, '5');
|
||||
INSERT INTO alter_compression_codec VALUES('2018-01-01', 6, '6');
|
||||
SELECT * FROM alter_compression_codec ORDER BY id;
|
||||
|
||||
OPTIMIZE TABLE test.alter_compression_codec FINAL;
|
||||
SELECT * FROM test.alter_compression_codec ORDER BY id;
|
||||
OPTIMIZE TABLE alter_compression_codec FINAL;
|
||||
SELECT * FROM alter_compression_codec ORDER BY id;
|
||||
|
||||
ALTER TABLE test.alter_compression_codec MODIFY COLUMN alter_column CODEC(ZSTD, LZ4HC, LZ4, LZ4, NONE);
|
||||
SELECT compression_codec FROM system.columns WHERE database = 'test' AND table = 'alter_compression_codec' AND name = 'alter_column';
|
||||
ALTER TABLE alter_compression_codec MODIFY COLUMN alter_column CODEC(ZSTD, LZ4HC, LZ4, LZ4, NONE);
|
||||
SELECT compression_codec FROM system.columns WHERE database = currentDatabase() AND table = 'alter_compression_codec' AND name = 'alter_column';
|
||||
|
||||
INSERT INTO test.alter_compression_codec VALUES('2018-01-01', 7, '7');
|
||||
INSERT INTO test.alter_compression_codec VALUES('2018-01-01', 8, '8');
|
||||
OPTIMIZE TABLE test.alter_compression_codec FINAL;
|
||||
SELECT * FROM test.alter_compression_codec ORDER BY id;
|
||||
INSERT INTO alter_compression_codec VALUES('2018-01-01', 7, '7');
|
||||
INSERT INTO alter_compression_codec VALUES('2018-01-01', 8, '8');
|
||||
OPTIMIZE TABLE alter_compression_codec FINAL;
|
||||
SELECT * FROM alter_compression_codec ORDER BY id;
|
||||
|
||||
ALTER TABLE test.alter_compression_codec MODIFY COLUMN alter_column FixedString(100);
|
||||
SELECT compression_codec FROM system.columns WHERE database = 'test' AND table = 'alter_compression_codec' AND name = 'alter_column';
|
||||
ALTER TABLE alter_compression_codec MODIFY COLUMN alter_column FixedString(100);
|
||||
SELECT compression_codec FROM system.columns WHERE database = currentDatabase() AND table = 'alter_compression_codec' AND name = 'alter_column';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS test.alter_compression_codec;
|
||||
DROP TABLE IF EXISTS alter_compression_codec;
|
||||
|
||||
DROP TABLE IF EXISTS test.alter_bad_codec;
|
||||
DROP TABLE IF EXISTS alter_bad_codec;
|
||||
|
||||
CREATE TABLE test.alter_bad_codec (
|
||||
CREATE TABLE alter_bad_codec (
|
||||
somedate Date CODEC(LZ4),
|
||||
id UInt64 CODEC(NONE)
|
||||
) ENGINE = MergeTree() ORDER BY tuple();
|
||||
|
||||
ALTER TABLE test.alter_bad_codec ADD COLUMN alter_column DateTime DEFAULT '2019-01-01 00:00:00' CODEC(gbdgkjsdh); -- { serverError 432 }
|
||||
ALTER TABLE alter_bad_codec ADD COLUMN alter_column DateTime DEFAULT '2019-01-01 00:00:00' CODEC(gbdgkjsdh); -- { serverError 432 }
|
||||
|
||||
ALTER TABLE test.alter_bad_codec ADD COLUMN alter_column DateTime DEFAULT '2019-01-01 00:00:00' CODEC(ZSTD(100)); -- { serverError 433 }
|
||||
ALTER TABLE alter_bad_codec ADD COLUMN alter_column DateTime DEFAULT '2019-01-01 00:00:00' CODEC(ZSTD(100)); -- { serverError 433 }
|
||||
|
||||
DROP TABLE IF EXISTS test.alter_bad_codec;
|
||||
DROP TABLE IF EXISTS alter_bad_codec;
|
||||
|
||||
DROP TABLE IF EXISTS test.large_alter_table_00804;
|
||||
DROP TABLE IF EXISTS test.store_of_hash_00804;
|
||||
DROP TABLE IF EXISTS large_alter_table_00804;
|
||||
DROP TABLE IF EXISTS store_of_hash_00804;
|
||||
|
||||
CREATE TABLE test.large_alter_table_00804 (
|
||||
CREATE TABLE large_alter_table_00804 (
|
||||
somedate Date CODEC(ZSTD, ZSTD, ZSTD(12), LZ4HC(12)),
|
||||
id UInt64 CODEC(LZ4, ZSTD, NONE, LZ4HC),
|
||||
data String CODEC(ZSTD(2), LZ4HC, NONE, LZ4, LZ4)
|
||||
) ENGINE = MergeTree() PARTITION BY somedate ORDER BY id SETTINGS index_granularity = 2;
|
||||
|
||||
INSERT INTO test.large_alter_table_00804 SELECT toDate('2019-01-01'), number, toString(number + rand()) FROM system.numbers LIMIT 300000;
|
||||
INSERT INTO large_alter_table_00804 SELECT toDate('2019-01-01'), number, toString(number + rand()) FROM system.numbers LIMIT 300000;
|
||||
|
||||
CREATE TABLE test.store_of_hash_00804 (hash UInt64) ENGINE = Memory();
|
||||
CREATE TABLE store_of_hash_00804 (hash UInt64) ENGINE = Memory();
|
||||
|
||||
INSERT INTO test.store_of_hash_00804 SELECT sum(cityHash64(*)) FROM test.large_alter_table_00804;
|
||||
INSERT INTO store_of_hash_00804 SELECT sum(cityHash64(*)) FROM large_alter_table_00804;
|
||||
|
||||
ALTER TABLE test.large_alter_table_00804 MODIFY COLUMN data CODEC(NONE, LZ4, LZ4HC, ZSTD);
|
||||
ALTER TABLE large_alter_table_00804 MODIFY COLUMN data CODEC(NONE, LZ4, LZ4HC, ZSTD);
|
||||
|
||||
OPTIMIZE TABLE test.large_alter_table_00804;
|
||||
OPTIMIZE TABLE large_alter_table_00804;
|
||||
|
||||
SELECT compression_codec FROM system.columns WHERE database = 'test' AND table = 'large_alter_table_00804' AND name = 'data';
|
||||
SELECT compression_codec FROM system.columns WHERE database = currentDatabase() AND table = 'large_alter_table_00804' AND name = 'data';
|
||||
|
||||
DETACH TABLE test.large_alter_table_00804;
|
||||
ATTACH TABLE test.large_alter_table_00804;
|
||||
DETACH TABLE large_alter_table_00804;
|
||||
ATTACH TABLE large_alter_table_00804;
|
||||
|
||||
INSERT INTO test.store_of_hash_00804 SELECT sum(cityHash64(*)) FROM test.large_alter_table_00804;
|
||||
INSERT INTO store_of_hash_00804 SELECT sum(cityHash64(*)) FROM large_alter_table_00804;
|
||||
|
||||
SELECT COUNT(hash) FROM test.store_of_hash_00804;
|
||||
SELECT COUNT(DISTINCT hash) FROM test.store_of_hash_00804;
|
||||
SELECT COUNT(hash) FROM store_of_hash_00804;
|
||||
SELECT COUNT(DISTINCT hash) FROM store_of_hash_00804;
|
||||
|
||||
DROP TABLE IF EXISTS test.large_alter_table_00804;
|
||||
DROP TABLE IF EXISTS test.store_of_hash_00804;
|
||||
DROP TABLE IF EXISTS large_alter_table_00804;
|
||||
DROP TABLE IF EXISTS store_of_hash_00804;
|
||||
|
@ -9,10 +9,10 @@
|
||||
10003
|
||||
274972506.6
|
||||
9175437371954010821
|
||||
CREATE TABLE test.compression_codec_multiple_more_types (`id` Decimal(38, 13) CODEC(ZSTD(1), LZ4, ZSTD(1), ZSTD(1), Delta(2), Delta(4), Delta(1), LZ4HC(0)), `data` FixedString(12) CODEC(ZSTD(1), ZSTD(1), Delta(1), Delta(1), Delta(1), NONE, NONE, NONE, LZ4HC(0)), `ddd.age` Array(UInt8) CODEC(LZ4, LZ4HC(0), NONE, NONE, NONE, ZSTD(1), Delta(8)), `ddd.Name` Array(String) CODEC(LZ4, LZ4HC(0), NONE, NONE, NONE, ZSTD(1), Delta(8))) ENGINE = MergeTree() ORDER BY tuple() SETTINGS index_granularity = 8192
|
||||
CREATE TABLE default.compression_codec_multiple_more_types (`id` Decimal(38, 13) CODEC(ZSTD(1), LZ4, ZSTD(1), ZSTD(1), Delta(2), Delta(4), Delta(1), LZ4HC(0)), `data` FixedString(12) CODEC(ZSTD(1), ZSTD(1), Delta(1), Delta(1), Delta(1), NONE, NONE, NONE, LZ4HC(0)), `ddd.age` Array(UInt8) CODEC(LZ4, LZ4HC(0), NONE, NONE, NONE, ZSTD(1), Delta(8)), `ddd.Name` Array(String) CODEC(LZ4, LZ4HC(0), NONE, NONE, NONE, ZSTD(1), Delta(8))) ENGINE = MergeTree() ORDER BY tuple() SETTINGS index_granularity = 8192
|
||||
1.5555555555555 hello world! [77] ['John']
|
||||
7.1000000000000 xxxxxxxxxxxx [127] ['Henry']
|
||||
!
|
||||
222
|
||||
!ZSTD
|
||||
CREATE TABLE test.test_default_delta (`id` UInt64 CODEC(Delta(8)), `data` String CODEC(Delta(1)), `somedate` Date CODEC(Delta(2)), `somenum` Float64 CODEC(Delta(8)), `somestr` FixedString(3) CODEC(Delta(1)), `othernum` Int64 CODEC(Delta(8)), `yetothernum` Float32 CODEC(Delta(4)), `ddd.age` Array(UInt8) CODEC(Delta(1)), `ddd.Name` Array(String) CODEC(Delta(1)), `ddd.OName` Array(String) CODEC(Delta(1)), `ddd.BName` Array(String) CODEC(Delta(1))) ENGINE = MergeTree() ORDER BY tuple() SETTINGS index_granularity = 8192
|
||||
CREATE TABLE default.test_default_delta (`id` UInt64 CODEC(Delta(8)), `data` String CODEC(Delta(1)), `somedate` Date CODEC(Delta(2)), `somenum` Float64 CODEC(Delta(8)), `somestr` FixedString(3) CODEC(Delta(1)), `othernum` Int64 CODEC(Delta(8)), `yetothernum` Float32 CODEC(Delta(4)), `ddd.age` Array(UInt8) CODEC(Delta(1)), `ddd.Name` Array(String) CODEC(Delta(1)), `ddd.OName` Array(String) CODEC(Delta(1)), `ddd.BName` Array(String) CODEC(Delta(1))) ENGINE = MergeTree() ORDER BY tuple() SETTINGS index_granularity = 8192
|
||||
|
@ -1,8 +1,8 @@
|
||||
SET send_logs_level = 'none';
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec;
|
||||
DROP TABLE IF EXISTS compression_codec;
|
||||
|
||||
CREATE TABLE test.compression_codec(
|
||||
CREATE TABLE compression_codec(
|
||||
id UInt64 CODEC(LZ4),
|
||||
data String CODEC(ZSTD),
|
||||
ddd Date CODEC(NONE),
|
||||
@ -11,124 +11,124 @@ CREATE TABLE test.compression_codec(
|
||||
othernum Int64 CODEC(Delta)
|
||||
) ENGINE = MergeTree() ORDER BY tuple();
|
||||
|
||||
INSERT INTO test.compression_codec VALUES(1, 'hello', toDate('2018-12-14'), 1.1, 'aaa', 5);
|
||||
INSERT INTO test.compression_codec VALUES(2, 'world', toDate('2018-12-15'), 2.2, 'bbb', 6);
|
||||
INSERT INTO test.compression_codec VALUES(3, '!', toDate('2018-12-16'), 3.3, 'ccc', 7);
|
||||
INSERT INTO compression_codec VALUES(1, 'hello', toDate('2018-12-14'), 1.1, 'aaa', 5);
|
||||
INSERT INTO compression_codec VALUES(2, 'world', toDate('2018-12-15'), 2.2, 'bbb', 6);
|
||||
INSERT INTO compression_codec VALUES(3, '!', toDate('2018-12-16'), 3.3, 'ccc', 7);
|
||||
|
||||
SELECT * FROM test.compression_codec ORDER BY id;
|
||||
SELECT * FROM compression_codec ORDER BY id;
|
||||
|
||||
OPTIMIZE TABLE test.compression_codec FINAL;
|
||||
OPTIMIZE TABLE compression_codec FINAL;
|
||||
|
||||
INSERT INTO test.compression_codec VALUES(2, '', toDate('2018-12-13'), 4.4, 'ddd', 8);
|
||||
INSERT INTO compression_codec VALUES(2, '', toDate('2018-12-13'), 4.4, 'ddd', 8);
|
||||
|
||||
DETACH TABLE test.compression_codec;
|
||||
ATTACH TABLE test.compression_codec;
|
||||
DETACH TABLE compression_codec;
|
||||
ATTACH TABLE compression_codec;
|
||||
|
||||
SELECT count(*) FROM test.compression_codec WHERE id = 2 GROUP BY id;
|
||||
SELECT count(*) FROM compression_codec WHERE id = 2 GROUP BY id;
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec;
|
||||
DROP TABLE IF EXISTS compression_codec;
|
||||
|
||||
DROP TABLE IF EXISTS test.bad_codec;
|
||||
DROP TABLE IF EXISTS test.params_when_no_params;
|
||||
DROP TABLE IF EXISTS test.too_many_params;
|
||||
DROP TABLE IF EXISTS test.codec_multiple_direct_specification_1;
|
||||
DROP TABLE IF EXISTS test.codec_multiple_direct_specification_2;
|
||||
DROP TABLE IF EXISTS test.delta_bad_params1;
|
||||
DROP TABLE IF EXISTS test.delta_bad_params2;
|
||||
DROP TABLE IF EXISTS bad_codec;
|
||||
DROP TABLE IF EXISTS params_when_no_params;
|
||||
DROP TABLE IF EXISTS too_many_params;
|
||||
DROP TABLE IF EXISTS codec_multiple_direct_specification_1;
|
||||
DROP TABLE IF EXISTS codec_multiple_direct_specification_2;
|
||||
DROP TABLE IF EXISTS delta_bad_params1;
|
||||
DROP TABLE IF EXISTS delta_bad_params2;
|
||||
|
||||
CREATE TABLE test.bad_codec(id UInt64 CODEC(adssadads)) ENGINE = MergeTree() order by tuple(); -- { serverError 432 }
|
||||
CREATE TABLE test.too_many_params(id UInt64 CODEC(ZSTD(2,3,4,5))) ENGINE = MergeTree() order by tuple(); -- { serverError 431 }
|
||||
CREATE TABLE test.params_when_no_params(id UInt64 CODEC(LZ4(1))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 378 }
|
||||
CREATE TABLE test.codec_multiple_direct_specification_1(id UInt64 CODEC(MULTIPLE(LZ4, ZSTD))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 432 }
|
||||
CREATE TABLE test.codec_multiple_direct_specification_2(id UInt64 CODEC(multiple(LZ4, ZSTD))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 432 }
|
||||
CREATE TABLE test.delta_bad_params1(id UInt64 CODEC(Delta(3))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 433 }
|
||||
CREATE TABLE test.delta_bad_params2(id UInt64 CODEC(Delta(16))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 433 }
|
||||
CREATE TABLE bad_codec(id UInt64 CODEC(adssadads)) ENGINE = MergeTree() order by tuple(); -- { serverError 432 }
|
||||
CREATE TABLE too_many_params(id UInt64 CODEC(ZSTD(2,3,4,5))) ENGINE = MergeTree() order by tuple(); -- { serverError 431 }
|
||||
CREATE TABLE params_when_no_params(id UInt64 CODEC(LZ4(1))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 378 }
|
||||
CREATE TABLE codec_multiple_direct_specification_1(id UInt64 CODEC(MULTIPLE(LZ4, ZSTD))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 432 }
|
||||
CREATE TABLE codec_multiple_direct_specification_2(id UInt64 CODEC(multiple(LZ4, ZSTD))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 432 }
|
||||
CREATE TABLE delta_bad_params1(id UInt64 CODEC(Delta(3))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 433 }
|
||||
CREATE TABLE delta_bad_params2(id UInt64 CODEC(Delta(16))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 433 }
|
||||
|
||||
DROP TABLE IF EXISTS test.bad_codec;
|
||||
DROP TABLE IF EXISTS test.params_when_no_params;
|
||||
DROP TABLE IF EXISTS test.too_many_params;
|
||||
DROP TABLE IF EXISTS test.codec_multiple_direct_specification_1;
|
||||
DROP TABLE IF EXISTS test.codec_multiple_direct_specification_2;
|
||||
DROP TABLE IF EXISTS test.delta_bad_params1;
|
||||
DROP TABLE IF EXISTS test.delta_bad_params2;
|
||||
DROP TABLE IF EXISTS bad_codec;
|
||||
DROP TABLE IF EXISTS params_when_no_params;
|
||||
DROP TABLE IF EXISTS too_many_params;
|
||||
DROP TABLE IF EXISTS codec_multiple_direct_specification_1;
|
||||
DROP TABLE IF EXISTS codec_multiple_direct_specification_2;
|
||||
DROP TABLE IF EXISTS delta_bad_params1;
|
||||
DROP TABLE IF EXISTS delta_bad_params2;
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec_multiple;
|
||||
DROP TABLE IF EXISTS compression_codec_multiple;
|
||||
|
||||
SET network_compression_method = 'lz4hc';
|
||||
|
||||
CREATE TABLE test.compression_codec_multiple (
|
||||
CREATE TABLE compression_codec_multiple (
|
||||
id UInt64 CODEC(LZ4, ZSTD, NONE, LZ4HC, Delta(4)),
|
||||
data String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC, LZ4, LZ4, Delta(8)),
|
||||
ddd Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD, LZ4HC, LZ4HC),
|
||||
somenum Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD)
|
||||
) ENGINE = MergeTree() ORDER BY tuple();
|
||||
|
||||
INSERT INTO test.compression_codec_multiple VALUES (1, 'world', toDate('2018-10-05'), 1.1), (2, 'hello', toDate('2018-10-01'), 2.2), (3, 'buy', toDate('2018-10-11'), 3.3);
|
||||
INSERT INTO compression_codec_multiple VALUES (1, 'world', toDate('2018-10-05'), 1.1), (2, 'hello', toDate('2018-10-01'), 2.2), (3, 'buy', toDate('2018-10-11'), 3.3);
|
||||
|
||||
SELECT * FROM test.compression_codec_multiple ORDER BY id;
|
||||
SELECT * FROM compression_codec_multiple ORDER BY id;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
INSERT INTO compression_codec_multiple select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
|
||||
SELECT count(*) FROM test.compression_codec_multiple;
|
||||
SELECT count(*) FROM compression_codec_multiple;
|
||||
|
||||
SELECT count(distinct data) FROM test.compression_codec_multiple;
|
||||
SELECT count(distinct data) FROM compression_codec_multiple;
|
||||
|
||||
SELECT floor(sum(somenum), 1) FROM test.compression_codec_multiple;
|
||||
SELECT floor(sum(somenum), 1) FROM compression_codec_multiple;
|
||||
|
||||
TRUNCATE TABLE test.compression_codec_multiple;
|
||||
TRUNCATE TABLE compression_codec_multiple;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
INSERT INTO compression_codec_multiple select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
|
||||
SELECT sum(cityHash64(*)) FROM test.compression_codec_multiple;
|
||||
SELECT sum(cityHash64(*)) FROM compression_codec_multiple;
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec_multiple_more_types;
|
||||
DROP TABLE IF EXISTS compression_codec_multiple_more_types;
|
||||
|
||||
CREATE TABLE test.compression_codec_multiple_more_types (
|
||||
CREATE TABLE compression_codec_multiple_more_types (
|
||||
id Decimal128(13) CODEC(ZSTD, LZ4, ZSTD, ZSTD, Delta(2), Delta(4), Delta(1), LZ4HC),
|
||||
data FixedString(12) CODEC(ZSTD, ZSTD, Delta, Delta, Delta, NONE, NONE, NONE, LZ4HC),
|
||||
ddd Nested (age UInt8, Name String) CODEC(LZ4, LZ4HC, NONE, NONE, NONE, ZSTD, Delta(8))
|
||||
) ENGINE = MergeTree() ORDER BY tuple();
|
||||
|
||||
SHOW CREATE TABLE test.compression_codec_multiple_more_types;
|
||||
SHOW CREATE TABLE compression_codec_multiple_more_types;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple_more_types VALUES(1.5555555555555, 'hello world!', [77], ['John']);
|
||||
INSERT INTO test.compression_codec_multiple_more_types VALUES(7.1, 'xxxxxxxxxxxx', [127], ['Henry']);
|
||||
INSERT INTO compression_codec_multiple_more_types VALUES(1.5555555555555, 'hello world!', [77], ['John']);
|
||||
INSERT INTO compression_codec_multiple_more_types VALUES(7.1, 'xxxxxxxxxxxx', [127], ['Henry']);
|
||||
|
||||
SELECT * FROM test.compression_codec_multiple_more_types order by id;
|
||||
SELECT * FROM compression_codec_multiple_more_types order by id;
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec_multiple_with_key;
|
||||
DROP TABLE IF EXISTS compression_codec_multiple_with_key;
|
||||
|
||||
SET network_compression_method = 'zstd';
|
||||
SET network_zstd_compression_level = 5;
|
||||
|
||||
CREATE TABLE test.compression_codec_multiple_with_key (
|
||||
CREATE TABLE compression_codec_multiple_with_key (
|
||||
somedate Date CODEC(ZSTD, ZSTD, ZSTD(12), LZ4HC(12), Delta, Delta),
|
||||
id UInt64 CODEC(LZ4, ZSTD, Delta, NONE, LZ4HC, Delta),
|
||||
data String CODEC(ZSTD(2), Delta, LZ4HC, NONE, LZ4, LZ4)
|
||||
) ENGINE = MergeTree() PARTITION BY somedate ORDER BY id SETTINGS index_granularity = 2;
|
||||
|
||||
|
||||
INSERT INTO test.compression_codec_multiple_with_key VALUES(toDate('2018-10-12'), 100000, 'hello'), (toDate('2018-10-12'), 100002, 'world'), (toDate('2018-10-12'), 1111, '!');
|
||||
INSERT INTO compression_codec_multiple_with_key VALUES(toDate('2018-10-12'), 100000, 'hello'), (toDate('2018-10-12'), 100002, 'world'), (toDate('2018-10-12'), 1111, '!');
|
||||
|
||||
SELECT data FROM test.compression_codec_multiple_with_key WHERE id BETWEEN 3 AND 1112;
|
||||
SELECT data FROM compression_codec_multiple_with_key WHERE id BETWEEN 3 AND 1112;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple_with_key SELECT toDate('2018-10-12'), number, toString(number) FROM system.numbers LIMIT 1000;
|
||||
INSERT INTO compression_codec_multiple_with_key SELECT toDate('2018-10-12'), number, toString(number) FROM system.numbers LIMIT 1000;
|
||||
|
||||
SELECT COUNT(DISTINCT data) FROM test.compression_codec_multiple_with_key WHERE id < 222;
|
||||
SELECT COUNT(DISTINCT data) FROM compression_codec_multiple_with_key WHERE id < 222;
|
||||
|
||||
-- method in lowercase
|
||||
SET network_compression_method = 'ZSTD';
|
||||
SET network_zstd_compression_level = 7;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple_with_key VALUES(toDate('2018-10-13'), 100001, 'hello1'), (toDate('2018-10-14'), 100003, 'world1'), (toDate('2018-10-15'), 2222, '!ZSTD');
|
||||
INSERT INTO compression_codec_multiple_with_key VALUES(toDate('2018-10-13'), 100001, 'hello1'), (toDate('2018-10-14'), 100003, 'world1'), (toDate('2018-10-15'), 2222, '!ZSTD');
|
||||
|
||||
SELECT data FROM test.compression_codec_multiple_with_key WHERE id = 2222;
|
||||
SELECT data FROM compression_codec_multiple_with_key WHERE id = 2222;
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec_multiple_with_key;
|
||||
DROP TABLE IF EXISTS compression_codec_multiple_with_key;
|
||||
|
||||
DROP TABLE IF EXISTS test.test_default_delta;
|
||||
DROP TABLE IF EXISTS test_default_delta;
|
||||
|
||||
CREATE TABLE test.test_default_delta(
|
||||
CREATE TABLE test_default_delta(
|
||||
id UInt64 CODEC(Delta),
|
||||
data String CODEC(Delta),
|
||||
somedate Date CODEC(Delta),
|
||||
@ -139,6 +139,8 @@ CREATE TABLE test.test_default_delta(
|
||||
ddd Nested (age UInt8, Name String, OName String, BName String) CODEC(Delta)
|
||||
) ENGINE = MergeTree() ORDER BY tuple();
|
||||
|
||||
SHOW CREATE TABLE test.test_default_delta;
|
||||
SHOW CREATE TABLE test_default_delta;
|
||||
|
||||
DROP TABLE IF EXISTS test.test_default_delta;
|
||||
DROP TABLE IF EXISTS test_default_delta;
|
||||
DROP TABLE compression_codec_multiple;
|
||||
DROP TABLE compression_codec_multiple_more_types;
|
||||
|
@ -1,9 +1,9 @@
|
||||
CREATE TABLE test.compression_codec_log (`id` UInt64 CODEC(LZ4), `data` String CODEC(ZSTD(1)), `ddd` Date CODEC(NONE), `somenum` Float64 CODEC(ZSTD(2)), `somestr` FixedString(3) CODEC(LZ4HC(7)), `othernum` Int64 CODEC(Delta(8))) ENGINE = Log()
|
||||
CREATE TABLE default.compression_codec_log (`id` UInt64 CODEC(LZ4), `data` String CODEC(ZSTD(1)), `ddd` Date CODEC(NONE), `somenum` Float64 CODEC(ZSTD(2)), `somestr` FixedString(3) CODEC(LZ4HC(7)), `othernum` Int64 CODEC(Delta(8))) ENGINE = Log()
|
||||
1 hello 2018-12-14 1.1 aaa 5
|
||||
2 world 2018-12-15 2.2 bbb 6
|
||||
3 ! 2018-12-16 3.3 ccc 7
|
||||
2
|
||||
CREATE TABLE test.compression_codec_multiple_log (`id` UInt64 CODEC(LZ4, ZSTD(1), NONE, LZ4HC(0), Delta(4)), `data` String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC(0), LZ4, LZ4, Delta(8)), `ddd` Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD(1), LZ4HC(0), LZ4HC(0)), `somenum` Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD(1))) ENGINE = Log()
|
||||
CREATE TABLE default.compression_codec_multiple_log (`id` UInt64 CODEC(LZ4, ZSTD(1), NONE, LZ4HC(0), Delta(4)), `data` String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC(0), LZ4, LZ4, Delta(8)), `ddd` Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD(1), LZ4HC(0), LZ4HC(0)), `somenum` Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD(1))) ENGINE = Log()
|
||||
1 world 2018-10-05 1.1
|
||||
2 hello 2018-10-01 2.2
|
||||
3 buy 2018-10-11 3.3
|
||||
@ -11,12 +11,12 @@ CREATE TABLE test.compression_codec_multiple_log (`id` UInt64 CODEC(LZ4, ZSTD(1)
|
||||
10003
|
||||
274972506.6
|
||||
9175437371954010821
|
||||
CREATE TABLE test.compression_codec_tiny_log (`id` UInt64 CODEC(LZ4), `data` String CODEC(ZSTD(1)), `ddd` Date CODEC(NONE), `somenum` Float64 CODEC(ZSTD(2)), `somestr` FixedString(3) CODEC(LZ4HC(7)), `othernum` Int64 CODEC(Delta(8))) ENGINE = TinyLog()
|
||||
CREATE TABLE default.compression_codec_tiny_log (`id` UInt64 CODEC(LZ4), `data` String CODEC(ZSTD(1)), `ddd` Date CODEC(NONE), `somenum` Float64 CODEC(ZSTD(2)), `somestr` FixedString(3) CODEC(LZ4HC(7)), `othernum` Int64 CODEC(Delta(8))) ENGINE = TinyLog()
|
||||
1 hello 2018-12-14 1.1 aaa 5
|
||||
2 world 2018-12-15 2.2 bbb 6
|
||||
3 ! 2018-12-16 3.3 ccc 7
|
||||
2
|
||||
CREATE TABLE test.compression_codec_multiple_tiny_log (`id` UInt64 CODEC(LZ4, ZSTD(1), NONE, LZ4HC(0), Delta(4)), `data` String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC(0), LZ4, LZ4, Delta(8)), `ddd` Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD(1), LZ4HC(0), LZ4HC(0)), `somenum` Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD(1))) ENGINE = TinyLog()
|
||||
CREATE TABLE default.compression_codec_multiple_tiny_log (`id` UInt64 CODEC(LZ4, ZSTD(1), NONE, LZ4HC(0), Delta(4)), `data` String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC(0), LZ4, LZ4, Delta(8)), `ddd` Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD(1), LZ4HC(0), LZ4HC(0)), `somenum` Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD(1))) ENGINE = TinyLog()
|
||||
1 world 2018-10-05 1.1
|
||||
2 hello 2018-10-01 2.2
|
||||
3 buy 2018-10-11 3.3
|
||||
|
@ -2,9 +2,9 @@ SET send_logs_level = 'none';
|
||||
|
||||
-- copy-paste for storage log
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec_log;
|
||||
DROP TABLE IF EXISTS compression_codec_log;
|
||||
|
||||
CREATE TABLE test.compression_codec_log(
|
||||
CREATE TABLE compression_codec_log(
|
||||
id UInt64 CODEC(LZ4),
|
||||
data String CODEC(ZSTD),
|
||||
ddd Date CODEC(NONE),
|
||||
@ -13,56 +13,56 @@ CREATE TABLE test.compression_codec_log(
|
||||
othernum Int64 CODEC(Delta)
|
||||
) ENGINE = Log();
|
||||
|
||||
SHOW CREATE TABLE test.compression_codec_log;
|
||||
SHOW CREATE TABLE compression_codec_log;
|
||||
|
||||
INSERT INTO test.compression_codec_log VALUES(1, 'hello', toDate('2018-12-14'), 1.1, 'aaa', 5);
|
||||
INSERT INTO test.compression_codec_log VALUES(2, 'world', toDate('2018-12-15'), 2.2, 'bbb', 6);
|
||||
INSERT INTO test.compression_codec_log VALUES(3, '!', toDate('2018-12-16'), 3.3, 'ccc', 7);
|
||||
INSERT INTO compression_codec_log VALUES(1, 'hello', toDate('2018-12-14'), 1.1, 'aaa', 5);
|
||||
INSERT INTO compression_codec_log VALUES(2, 'world', toDate('2018-12-15'), 2.2, 'bbb', 6);
|
||||
INSERT INTO compression_codec_log VALUES(3, '!', toDate('2018-12-16'), 3.3, 'ccc', 7);
|
||||
|
||||
SELECT * FROM test.compression_codec_log ORDER BY id;
|
||||
SELECT * FROM compression_codec_log ORDER BY id;
|
||||
|
||||
INSERT INTO test.compression_codec_log VALUES(2, '', toDate('2018-12-13'), 4.4, 'ddd', 8);
|
||||
INSERT INTO compression_codec_log VALUES(2, '', toDate('2018-12-13'), 4.4, 'ddd', 8);
|
||||
|
||||
DETACH TABLE test.compression_codec_log;
|
||||
ATTACH TABLE test.compression_codec_log;
|
||||
DETACH TABLE compression_codec_log;
|
||||
ATTACH TABLE compression_codec_log;
|
||||
|
||||
SELECT count(*) FROM test.compression_codec_log WHERE id = 2 GROUP BY id;
|
||||
SELECT count(*) FROM compression_codec_log WHERE id = 2 GROUP BY id;
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec_log;
|
||||
DROP TABLE IF EXISTS compression_codec_log;
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec_multiple_log;
|
||||
DROP TABLE IF EXISTS compression_codec_multiple_log;
|
||||
|
||||
CREATE TABLE test.compression_codec_multiple_log (
|
||||
CREATE TABLE compression_codec_multiple_log (
|
||||
id UInt64 CODEC(LZ4, ZSTD, NONE, LZ4HC, Delta(4)),
|
||||
data String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC, LZ4, LZ4, Delta(8)),
|
||||
ddd Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD, LZ4HC, LZ4HC),
|
||||
somenum Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD)
|
||||
) ENGINE = Log();
|
||||
|
||||
SHOW CREATE TABLE test.compression_codec_multiple_log;
|
||||
SHOW CREATE TABLE compression_codec_multiple_log;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple_log VALUES (1, 'world', toDate('2018-10-05'), 1.1), (2, 'hello', toDate('2018-10-01'), 2.2), (3, 'buy', toDate('2018-10-11'), 3.3);
|
||||
INSERT INTO compression_codec_multiple_log VALUES (1, 'world', toDate('2018-10-05'), 1.1), (2, 'hello', toDate('2018-10-01'), 2.2), (3, 'buy', toDate('2018-10-11'), 3.3);
|
||||
|
||||
SELECT * FROM test.compression_codec_multiple_log ORDER BY id;
|
||||
SELECT * FROM compression_codec_multiple_log ORDER BY id;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple_log select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
INSERT INTO compression_codec_multiple_log select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
|
||||
SELECT count(*) FROM test.compression_codec_multiple_log;
|
||||
SELECT count(*) FROM compression_codec_multiple_log;
|
||||
|
||||
SELECT count(distinct data) FROM test.compression_codec_multiple_log;
|
||||
SELECT count(distinct data) FROM compression_codec_multiple_log;
|
||||
|
||||
SELECT floor(sum(somenum), 1) FROM test.compression_codec_multiple_log;
|
||||
SELECT floor(sum(somenum), 1) FROM compression_codec_multiple_log;
|
||||
|
||||
TRUNCATE TABLE test.compression_codec_multiple_log;
|
||||
TRUNCATE TABLE compression_codec_multiple_log;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple_log select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
INSERT INTO compression_codec_multiple_log select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
|
||||
SELECT sum(cityHash64(*)) FROM test.compression_codec_multiple_log;
|
||||
SELECT sum(cityHash64(*)) FROM compression_codec_multiple_log;
|
||||
|
||||
-- copy-paste for storage tiny log
|
||||
DROP TABLE IF EXISTS test.compression_codec_tiny_log;
|
||||
DROP TABLE IF EXISTS compression_codec_tiny_log;
|
||||
|
||||
CREATE TABLE test.compression_codec_tiny_log(
|
||||
CREATE TABLE compression_codec_tiny_log(
|
||||
id UInt64 CODEC(LZ4),
|
||||
data String CODEC(ZSTD),
|
||||
ddd Date CODEC(NONE),
|
||||
@ -71,48 +71,48 @@ CREATE TABLE test.compression_codec_tiny_log(
|
||||
othernum Int64 CODEC(Delta)
|
||||
) ENGINE = TinyLog();
|
||||
|
||||
SHOW CREATE TABLE test.compression_codec_tiny_log;
|
||||
SHOW CREATE TABLE compression_codec_tiny_log;
|
||||
|
||||
INSERT INTO test.compression_codec_tiny_log VALUES(1, 'hello', toDate('2018-12-14'), 1.1, 'aaa', 5);
|
||||
INSERT INTO test.compression_codec_tiny_log VALUES(2, 'world', toDate('2018-12-15'), 2.2, 'bbb', 6);
|
||||
INSERT INTO test.compression_codec_tiny_log VALUES(3, '!', toDate('2018-12-16'), 3.3, 'ccc', 7);
|
||||
INSERT INTO compression_codec_tiny_log VALUES(1, 'hello', toDate('2018-12-14'), 1.1, 'aaa', 5);
|
||||
INSERT INTO compression_codec_tiny_log VALUES(2, 'world', toDate('2018-12-15'), 2.2, 'bbb', 6);
|
||||
INSERT INTO compression_codec_tiny_log VALUES(3, '!', toDate('2018-12-16'), 3.3, 'ccc', 7);
|
||||
|
||||
SELECT * FROM test.compression_codec_tiny_log ORDER BY id;
|
||||
SELECT * FROM compression_codec_tiny_log ORDER BY id;
|
||||
|
||||
INSERT INTO test.compression_codec_tiny_log VALUES(2, '', toDate('2018-12-13'), 4.4, 'ddd', 8);
|
||||
INSERT INTO compression_codec_tiny_log VALUES(2, '', toDate('2018-12-13'), 4.4, 'ddd', 8);
|
||||
|
||||
DETACH TABLE test.compression_codec_tiny_log;
|
||||
ATTACH TABLE test.compression_codec_tiny_log;
|
||||
DETACH TABLE compression_codec_tiny_log;
|
||||
ATTACH TABLE compression_codec_tiny_log;
|
||||
|
||||
SELECT count(*) FROM test.compression_codec_tiny_log WHERE id = 2 GROUP BY id;
|
||||
SELECT count(*) FROM compression_codec_tiny_log WHERE id = 2 GROUP BY id;
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec_tiny_log;
|
||||
DROP TABLE IF EXISTS compression_codec_tiny_log;
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec_multiple_tiny_log;
|
||||
DROP TABLE IF EXISTS compression_codec_multiple_tiny_log;
|
||||
|
||||
CREATE TABLE test.compression_codec_multiple_tiny_log (
|
||||
CREATE TABLE compression_codec_multiple_tiny_log (
|
||||
id UInt64 CODEC(LZ4, ZSTD, NONE, LZ4HC, Delta(4)),
|
||||
data String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC, LZ4, LZ4, Delta(8)),
|
||||
ddd Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD, LZ4HC, LZ4HC),
|
||||
somenum Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD)
|
||||
) ENGINE = TinyLog();
|
||||
|
||||
SHOW CREATE TABLE test.compression_codec_multiple_tiny_log;
|
||||
SHOW CREATE TABLE compression_codec_multiple_tiny_log;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple_tiny_log VALUES (1, 'world', toDate('2018-10-05'), 1.1), (2, 'hello', toDate('2018-10-01'), 2.2), (3, 'buy', toDate('2018-10-11'), 3.3);
|
||||
INSERT INTO compression_codec_multiple_tiny_log VALUES (1, 'world', toDate('2018-10-05'), 1.1), (2, 'hello', toDate('2018-10-01'), 2.2), (3, 'buy', toDate('2018-10-11'), 3.3);
|
||||
|
||||
SELECT * FROM test.compression_codec_multiple_tiny_log ORDER BY id;
|
||||
SELECT * FROM compression_codec_multiple_tiny_log ORDER BY id;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple_tiny_log select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
INSERT INTO compression_codec_multiple_tiny_log select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
|
||||
SELECT count(*) FROM test.compression_codec_multiple_tiny_log;
|
||||
SELECT count(*) FROM compression_codec_multiple_tiny_log;
|
||||
|
||||
SELECT count(distinct data) FROM test.compression_codec_multiple_tiny_log;
|
||||
SELECT count(distinct data) FROM compression_codec_multiple_tiny_log;
|
||||
|
||||
SELECT floor(sum(somenum), 1) FROM test.compression_codec_multiple_tiny_log;
|
||||
SELECT floor(sum(somenum), 1) FROM compression_codec_multiple_tiny_log;
|
||||
|
||||
TRUNCATE TABLE test.compression_codec_multiple_tiny_log;
|
||||
TRUNCATE TABLE compression_codec_multiple_tiny_log;
|
||||
|
||||
INSERT INTO test.compression_codec_multiple_tiny_log select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
INSERT INTO compression_codec_multiple_tiny_log select modulo(number, 100), toString(number), toDate('2018-12-01'), 5.5 * number FROM system.numbers limit 10000;
|
||||
|
||||
SELECT sum(cityHash64(*)) FROM test.compression_codec_multiple_tiny_log;
|
||||
SELECT sum(cityHash64(*)) FROM compression_codec_multiple_tiny_log;
|
||||
|
@ -1,10 +1,10 @@
|
||||
SET send_logs_level = 'none';
|
||||
|
||||
DROP TABLE IF EXISTS test.delta_codec_for_alter;
|
||||
CREATE TABLE test.delta_codec_for_alter (date Date, x UInt32 Codec(Delta), s FixedString(128)) ENGINE = MergeTree ORDER BY tuple();
|
||||
SELECT compression_codec FROM system.columns WHERE database = 'test' AND table = 'delta_codec_for_alter' AND name = 'x';
|
||||
ALTER TABLE test.delta_codec_for_alter MODIFY COLUMN x Codec(Delta, LZ4);
|
||||
SELECT compression_codec FROM system.columns WHERE database = 'test' AND table = 'delta_codec_for_alter' AND name = 'x';
|
||||
ALTER TABLE test.delta_codec_for_alter MODIFY COLUMN x UInt64 Codec(Delta, LZ4);
|
||||
SELECT compression_codec FROM system.columns WHERE database = 'test' AND table = 'delta_codec_for_alter' AND name = 'x';
|
||||
DROP TABLE IF EXISTS test.delta_codec_for_alter;
|
||||
DROP TABLE IF EXISTS delta_codec_for_alter;
|
||||
CREATE TABLE delta_codec_for_alter (date Date, x UInt32 Codec(Delta), s FixedString(128)) ENGINE = MergeTree ORDER BY tuple();
|
||||
SELECT compression_codec FROM system.columns WHERE database = currentDatabase() AND table = 'delta_codec_for_alter' AND name = 'x';
|
||||
ALTER TABLE delta_codec_for_alter MODIFY COLUMN x Codec(Delta, LZ4);
|
||||
SELECT compression_codec FROM system.columns WHERE database = currentDatabase() AND table = 'delta_codec_for_alter' AND name = 'x';
|
||||
ALTER TABLE delta_codec_for_alter MODIFY COLUMN x UInt64 Codec(Delta, LZ4);
|
||||
SELECT compression_codec FROM system.columns WHERE database = currentDatabase() AND table = 'delta_codec_for_alter' AND name = 'x';
|
||||
DROP TABLE IF EXISTS delta_codec_for_alter;
|
||||
|
@ -1,5 +1,3 @@
|
||||
USE test;
|
||||
|
||||
DROP TABLE IF EXISTS local_table;
|
||||
DROP TABLE IF EXISTS other_table;
|
||||
|
||||
@ -24,33 +22,33 @@ INSERT INTO local_table VALUES(2, 'Two', now(), 200);
|
||||
INSERT INTO other_table VALUES(100, 'One Hundred', now(), 1000);
|
||||
INSERT INTO other_table VALUES(200, 'Two Hundred', now(), 2000);
|
||||
|
||||
-- FIXME: test.other_table -> other_table in first query breaks test (external tables cache error)
|
||||
select t2.name from remote('127.0.0.2', 'test.local_table') as t1
|
||||
left join test.other_table as t2
|
||||
-- FIXME: other_table -> other_table in first query breaks test (external tables cache error)
|
||||
select t2.name from remote('127.0.0.2', currentDatabase(), 'local_table') as t1
|
||||
left join other_table as t2
|
||||
on t1.oth_id = t2.id
|
||||
order by t2.name;
|
||||
|
||||
select t2.name from test.other_table as t2
|
||||
global right join remote('127.0.0.2', 'test.local_table') as t1
|
||||
select t2.name from other_table as t2
|
||||
global right join remote('127.0.0.2', currentDatabase(), 'local_table') as t1
|
||||
on t1.oth_id = t2.id
|
||||
order by t2.name;
|
||||
|
||||
select t2.name from remote('127.0.0.2', 'test.local_table') as t1
|
||||
select t2.name from remote('127.0.0.2', currentDatabase(), 'local_table') as t1
|
||||
global left join other_table as t2
|
||||
on t1.oth_id = t2.id
|
||||
order by t2.name;
|
||||
|
||||
select t2.name from remote('127.0.0.2', 'test.local_table') as t1
|
||||
select t2.name from remote('127.0.0.2', currentDatabase(), 'local_table') as t1
|
||||
global left join other_table as t2
|
||||
on t1.oth_id = t2.id
|
||||
order by t2.name;
|
||||
|
||||
select other_table.name from remote('127.0.0.2', 'test.local_table') as t1
|
||||
select other_table.name from remote('127.0.0.2', currentDatabase(), 'local_table') as t1
|
||||
global left join other_table
|
||||
on t1.oth_id = other_table.id
|
||||
order by other_table.name;
|
||||
|
||||
select other_table.name from remote('127.0.0.2', 'test.local_table') as t1
|
||||
select other_table.name from remote('127.0.0.2', currentDatabase(), 'local_table') as t1
|
||||
global left join other_table as t2
|
||||
on t1.oth_id = other_table.id
|
||||
order by other_table.name;
|
||||
|
@ -1,5 +1,3 @@
|
||||
USE test;
|
||||
|
||||
DROP TABLE IF EXISTS temp;
|
||||
CREATE TABLE temp
|
||||
(
|
||||
|
@ -1,7 +1,7 @@
|
||||
DROP TABLE IF EXISTS test.union1;
|
||||
DROP TABLE IF EXISTS test.union2;
|
||||
CREATE TABLE test.union1 ( date Date, a Int32, b Int32, c Int32, d Int32) ENGINE = MergeTree(date, (a, date), 8192);
|
||||
CREATE TABLE test.union2 ( date Date, a Int32, b Int32, c Int32, d Int32) ENGINE = Distributed(test_shard_localhost, 'test', 'union1');
|
||||
ALTER TABLE test.union2 MODIFY ORDER BY a; -- { serverError 48 }
|
||||
DROP TABLE test.union1;
|
||||
DROP TABLE test.union2;
|
||||
DROP TABLE IF EXISTS union1;
|
||||
DROP TABLE IF EXISTS union2;
|
||||
CREATE TABLE union1 ( date Date, a Int32, b Int32, c Int32, d Int32) ENGINE = MergeTree(date, (a, date), 8192);
|
||||
CREATE TABLE union2 ( date Date, a Int32, b Int32, c Int32, d Int32) ENGINE = Distributed(test_shard_localhost, currentDatabase(), 'union1');
|
||||
ALTER TABLE union2 MODIFY ORDER BY a; -- { serverError 48 }
|
||||
DROP TABLE union1;
|
||||
DROP TABLE union2;
|
||||
|
@ -1,8 +1,6 @@
|
||||
-- This test creates many threads to test a case when ThreadPool will remove some threads from pool after job is done.
|
||||
SET max_block_size = 1, min_insert_block_size_rows = 0, min_insert_block_size_bytes = 0;
|
||||
|
||||
USE test;
|
||||
|
||||
CREATE TEMPORARY TABLE t (x UInt64);
|
||||
INSERT INTO t SELECT * FROM system.numbers LIMIT 1500;
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
CREATE VIEW test.t (`number` UInt64) AS SELECT number FROM system.numbers
|
||||
CREATE VIEW test.t (`next_number` UInt64) AS SELECT number + 1 AS next_number FROM system.numbers
|
||||
CREATE VIEW default.t (`number` UInt64) AS SELECT number FROM system.numbers
|
||||
CREATE VIEW default.t (`next_number` UInt64) AS SELECT number + 1 AS next_number FROM system.numbers
|
||||
|
@ -1,9 +1,9 @@
|
||||
DROP TABLE IF EXISTS test.t;
|
||||
DROP TABLE IF EXISTS t;
|
||||
|
||||
CREATE OR REPLACE VIEW test.t (number UInt64) AS SELECT number FROM system.numbers;
|
||||
SHOW CREATE TABLE test.t;
|
||||
CREATE OR REPLACE VIEW t (number UInt64) AS SELECT number FROM system.numbers;
|
||||
SHOW CREATE TABLE t;
|
||||
|
||||
CREATE OR REPLACE VIEW test.t AS SELECT number+1 AS next_number FROM system.numbers;
|
||||
SHOW CREATE TABLE test.t;
|
||||
CREATE OR REPLACE VIEW t AS SELECT number+1 AS next_number FROM system.numbers;
|
||||
SHOW CREATE TABLE t;
|
||||
|
||||
DROP TABLE test.t;
|
||||
DROP TABLE t;
|
||||
|
@ -1,85 +1,85 @@
|
||||
SET send_logs_level = 'none';
|
||||
SELECT '----00489----';
|
||||
DROP TABLE IF EXISTS test.pk;
|
||||
DROP TABLE IF EXISTS pk;
|
||||
|
||||
CREATE TABLE test.pk (d Date DEFAULT '2000-01-01', x DateTime, y UInt64, z UInt64) ENGINE = MergeTree() PARTITION BY d ORDER BY (toStartOfMinute(x), y, z) SETTINGS index_granularity_bytes=19; -- one row granule
|
||||
CREATE TABLE pk (d Date DEFAULT '2000-01-01', x DateTime, y UInt64, z UInt64) ENGINE = MergeTree() PARTITION BY d ORDER BY (toStartOfMinute(x), y, z) SETTINGS index_granularity_bytes=19; -- one row granule
|
||||
|
||||
INSERT INTO test.pk (x, y, z) VALUES (1, 11, 1235), (2, 11, 4395), (3, 22, 3545), (4, 22, 6984), (5, 33, 4596), (61, 11, 4563), (62, 11, 4578), (63, 11, 3572), (64, 22, 5786), (65, 22, 5786), (66, 22, 2791), (67, 22, 2791), (121, 33, 2791), (122, 33, 2791), (123, 33, 1235), (124, 44, 4935), (125, 44, 4578), (126, 55, 5786), (127, 55, 2791), (128, 55, 1235);
|
||||
INSERT INTO pk (x, y, z) VALUES (1, 11, 1235), (2, 11, 4395), (3, 22, 3545), (4, 22, 6984), (5, 33, 4596), (61, 11, 4563), (62, 11, 4578), (63, 11, 3572), (64, 22, 5786), (65, 22, 5786), (66, 22, 2791), (67, 22, 2791), (121, 33, 2791), (122, 33, 2791), (123, 33, 1235), (124, 44, 4935), (125, 44, 4578), (126, 55, 5786), (127, 55, 2791), (128, 55, 1235);
|
||||
|
||||
SET max_block_size = 1;
|
||||
|
||||
-- Test inferred limit
|
||||
SET max_rows_to_read = 5;
|
||||
SELECT toUInt32(x), y, z FROM test.pk WHERE x BETWEEN toDateTime(0) AND toDateTime(59);
|
||||
SELECT toUInt32(x), y, z FROM pk WHERE x BETWEEN toDateTime(0) AND toDateTime(59);
|
||||
|
||||
SET max_rows_to_read = 9;
|
||||
SELECT toUInt32(x), y, z FROM test.pk WHERE x BETWEEN toDateTime(120) AND toDateTime(240);
|
||||
SELECT toUInt32(x), y, z FROM pk WHERE x BETWEEN toDateTime(120) AND toDateTime(240);
|
||||
|
||||
-- Index is coarse, cannot read single row
|
||||
SET max_rows_to_read = 5;
|
||||
SELECT toUInt32(x), y, z FROM test.pk WHERE x = toDateTime(1);
|
||||
SELECT toUInt32(x), y, z FROM pk WHERE x = toDateTime(1);
|
||||
|
||||
-- Index works on interval 00:01:00 - 00:01:59
|
||||
SET max_rows_to_read = 4;
|
||||
SELECT toUInt32(x), y, z FROM test.pk WHERE x BETWEEN toDateTime(60) AND toDateTime(119) AND y = 11;
|
||||
SELECT toUInt32(x), y, z FROM pk WHERE x BETWEEN toDateTime(60) AND toDateTime(119) AND y = 11;
|
||||
|
||||
-- Cannot read less rows as PK is coarser on interval 00:01:00 - 00:02:00
|
||||
SET max_rows_to_read = 5;
|
||||
SELECT toUInt32(x), y, z FROM test.pk WHERE x BETWEEN toDateTime(60) AND toDateTime(120) AND y = 11;
|
||||
SELECT toUInt32(x), y, z FROM pk WHERE x BETWEEN toDateTime(60) AND toDateTime(120) AND y = 11;
|
||||
|
||||
DROP TABLE test.pk;
|
||||
DROP TABLE pk;
|
||||
|
||||
SET max_block_size = 8192;
|
||||
SELECT '----00607----';
|
||||
|
||||
SET max_rows_to_read = 0;
|
||||
DROP TABLE IF EXISTS test.merge_tree;
|
||||
CREATE TABLE test.merge_tree (x UInt32) ENGINE = MergeTree ORDER BY x SETTINGS index_granularity_bytes = 4;
|
||||
INSERT INTO test.merge_tree VALUES (0), (1);
|
||||
DROP TABLE IF EXISTS merge_tree;
|
||||
CREATE TABLE merge_tree (x UInt32) ENGINE = MergeTree ORDER BY x SETTINGS index_granularity_bytes = 4;
|
||||
INSERT INTO merge_tree VALUES (0), (1);
|
||||
|
||||
SET force_primary_key = 1;
|
||||
SET max_rows_to_read = 1;
|
||||
|
||||
SELECT count() FROM test.merge_tree WHERE x = 0;
|
||||
SELECT count() FROM test.merge_tree WHERE toUInt32(x) = 0;
|
||||
SELECT count() FROM test.merge_tree WHERE toUInt64(x) = 0;
|
||||
SELECT count() FROM merge_tree WHERE x = 0;
|
||||
SELECT count() FROM merge_tree WHERE toUInt32(x) = 0;
|
||||
SELECT count() FROM merge_tree WHERE toUInt64(x) = 0;
|
||||
|
||||
SELECT count() FROM test.merge_tree WHERE x IN (0, 0);
|
||||
SELECT count() FROM test.merge_tree WHERE toUInt32(x) IN (0, 0);
|
||||
SELECT count() FROM test.merge_tree WHERE toUInt64(x) IN (0, 0);
|
||||
SELECT count() FROM merge_tree WHERE x IN (0, 0);
|
||||
SELECT count() FROM merge_tree WHERE toUInt32(x) IN (0, 0);
|
||||
SELECT count() FROM merge_tree WHERE toUInt64(x) IN (0, 0);
|
||||
|
||||
DROP TABLE test.merge_tree;
|
||||
DROP TABLE merge_tree;
|
||||
|
||||
SELECT '----00804----';
|
||||
SET max_rows_to_read = 0;
|
||||
SET force_primary_key = 0;
|
||||
|
||||
DROP TABLE IF EXISTS test.large_alter_table_00926;
|
||||
DROP TABLE IF EXISTS test.store_of_hash_00926;
|
||||
DROP TABLE IF EXISTS large_alter_table_00926;
|
||||
DROP TABLE IF EXISTS store_of_hash_00926;
|
||||
|
||||
CREATE TABLE test.large_alter_table_00926 (
|
||||
CREATE TABLE large_alter_table_00926 (
|
||||
somedate Date CODEC(ZSTD, ZSTD, ZSTD(12), LZ4HC(12)),
|
||||
id UInt64 CODEC(LZ4, ZSTD, NONE, LZ4HC),
|
||||
data String CODEC(ZSTD(2), LZ4HC, NONE, LZ4, LZ4)
|
||||
) ENGINE = MergeTree() PARTITION BY somedate ORDER BY id SETTINGS index_granularity_bytes=40;
|
||||
|
||||
INSERT INTO test.large_alter_table_00926 SELECT toDate('2019-01-01'), number, toString(number + rand()) FROM system.numbers LIMIT 300000;
|
||||
INSERT INTO large_alter_table_00926 SELECT toDate('2019-01-01'), number, toString(number + rand()) FROM system.numbers LIMIT 300000;
|
||||
|
||||
CREATE TABLE test.store_of_hash_00926 (hash UInt64) ENGINE = Memory();
|
||||
CREATE TABLE store_of_hash_00926 (hash UInt64) ENGINE = Memory();
|
||||
|
||||
INSERT INTO test.store_of_hash_00926 SELECT sum(cityHash64(*)) FROM test.large_alter_table_00926;
|
||||
INSERT INTO store_of_hash_00926 SELECT sum(cityHash64(*)) FROM large_alter_table_00926;
|
||||
|
||||
ALTER TABLE test.large_alter_table_00926 MODIFY COLUMN data CODEC(NONE, LZ4, LZ4HC, ZSTD);
|
||||
ALTER TABLE large_alter_table_00926 MODIFY COLUMN data CODEC(NONE, LZ4, LZ4HC, ZSTD);
|
||||
|
||||
OPTIMIZE TABLE test.large_alter_table_00926;
|
||||
OPTIMIZE TABLE large_alter_table_00926;
|
||||
|
||||
DETACH TABLE test.large_alter_table_00926;
|
||||
ATTACH TABLE test.large_alter_table_00926;
|
||||
DETACH TABLE large_alter_table_00926;
|
||||
ATTACH TABLE large_alter_table_00926;
|
||||
|
||||
INSERT INTO test.store_of_hash_00926 SELECT sum(cityHash64(*)) FROM test.large_alter_table_00926;
|
||||
INSERT INTO store_of_hash_00926 SELECT sum(cityHash64(*)) FROM large_alter_table_00926;
|
||||
|
||||
SELECT COUNT(hash) FROM test.store_of_hash_00926;
|
||||
SELECT COUNT(DISTINCT hash) FROM test.store_of_hash_00926;
|
||||
SELECT COUNT(hash) FROM store_of_hash_00926;
|
||||
SELECT COUNT(DISTINCT hash) FROM store_of_hash_00926;
|
||||
|
||||
DROP TABLE IF EXISTS test.large_alter_table_00926;
|
||||
DROP TABLE IF EXISTS test.store_of_hash_00926;
|
||||
DROP TABLE IF EXISTS large_alter_table_00926;
|
||||
DROP TABLE IF EXISTS store_of_hash_00926;
|
||||
|
@ -1,7 +1,7 @@
|
||||
----- Group of very similar simple tests ------
|
||||
DROP TABLE IF EXISTS test.zero_rows_per_granule;
|
||||
DROP TABLE IF EXISTS zero_rows_per_granule;
|
||||
|
||||
CREATE TABLE test.zero_rows_per_granule (
|
||||
CREATE TABLE zero_rows_per_granule (
|
||||
p Date,
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
@ -12,27 +12,27 @@ CREATE TABLE test.zero_rows_per_granule (
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
|
||||
INSERT INTO test.zero_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
INSERT INTO zero_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
SELECT COUNT(*) FROM test.zero_rows_per_granule;
|
||||
SELECT COUNT(*) FROM zero_rows_per_granule;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'zero_rows_per_granule' and database='test' and active=1;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'zero_rows_per_granule' and database=currentDatabase() and active=1;
|
||||
|
||||
INSERT INTO test.zero_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
INSERT INTO zero_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
|
||||
OPTIMIZE TABLE test.zero_rows_per_granule FINAL;
|
||||
OPTIMIZE TABLE zero_rows_per_granule FINAL;
|
||||
|
||||
SELECT COUNT(*) FROM test.zero_rows_per_granule FINAL;
|
||||
SELECT COUNT(*) FROM zero_rows_per_granule FINAL;
|
||||
|
||||
SELECT sum(marks) from system.parts WHERE table = 'zero_rows_per_granule' and database='test' and active=1;
|
||||
SELECT sum(marks) from system.parts WHERE table = 'zero_rows_per_granule' and database=currentDatabase() and active=1;
|
||||
|
||||
DROP TABLE IF EXISTS test.zero_rows_per_granule;
|
||||
DROP TABLE IF EXISTS zero_rows_per_granule;
|
||||
|
||||
SELECT '-----';
|
||||
|
||||
DROP TABLE IF EXISTS test.two_rows_per_granule;
|
||||
DROP TABLE IF EXISTS two_rows_per_granule;
|
||||
|
||||
CREATE TABLE test.two_rows_per_granule (
|
||||
CREATE TABLE two_rows_per_granule (
|
||||
p Date,
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
@ -43,27 +43,27 @@ CREATE TABLE test.two_rows_per_granule (
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
|
||||
INSERT INTO test.two_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
INSERT INTO two_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
SELECT COUNT(*) FROM test.two_rows_per_granule FINAL;
|
||||
SELECT COUNT(*) FROM two_rows_per_granule FINAL;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'two_rows_per_granule' and database='test' and active=1;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'two_rows_per_granule' and database=currentDatabase() and active=1;
|
||||
|
||||
INSERT INTO test.two_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
INSERT INTO two_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
|
||||
OPTIMIZE TABLE test.two_rows_per_granule FINAL;
|
||||
OPTIMIZE TABLE two_rows_per_granule FINAL;
|
||||
|
||||
SELECT COUNT(*) FROM test.two_rows_per_granule FINAL;
|
||||
SELECT COUNT(*) FROM two_rows_per_granule FINAL;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'two_rows_per_granule' and database='test' and active=1;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'two_rows_per_granule' and database=currentDatabase() and active=1;
|
||||
|
||||
DROP TABLE IF EXISTS test.two_rows_per_granule;
|
||||
DROP TABLE IF EXISTS two_rows_per_granule;
|
||||
|
||||
SELECT '-----';
|
||||
|
||||
DROP TABLE IF EXISTS test.four_rows_per_granule;
|
||||
DROP TABLE IF EXISTS four_rows_per_granule;
|
||||
|
||||
CREATE TABLE test.four_rows_per_granule (
|
||||
CREATE TABLE four_rows_per_granule (
|
||||
p Date,
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
@ -74,42 +74,42 @@ CREATE TABLE test.four_rows_per_granule (
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
|
||||
INSERT INTO test.four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
INSERT INTO four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
SELECT COUNT(*) FROM test.four_rows_per_granule;
|
||||
SELECT COUNT(*) FROM four_rows_per_granule;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'four_rows_per_granule' and database='test' and active=1;
|
||||
DETACH TABLE test.four_rows_per_granule;
|
||||
ATTACH TABLE test.four_rows_per_granule;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'four_rows_per_granule' and database=currentDatabase() and active=1;
|
||||
DETACH TABLE four_rows_per_granule;
|
||||
ATTACH TABLE four_rows_per_granule;
|
||||
|
||||
INSERT INTO test.four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
INSERT INTO four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
|
||||
INSERT INTO test.four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
INSERT INTO four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
|
||||
INSERT INTO test.four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
INSERT INTO four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
|
||||
INSERT INTO test.four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
INSERT INTO four_rows_per_granule (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
|
||||
SELECT sleep(0.5) Format Null;
|
||||
|
||||
OPTIMIZE TABLE test.four_rows_per_granule FINAL;
|
||||
OPTIMIZE TABLE four_rows_per_granule FINAL;
|
||||
|
||||
DETACH TABLE test.four_rows_per_granule;
|
||||
DETACH TABLE four_rows_per_granule;
|
||||
|
||||
ATTACH TABLE test.four_rows_per_granule;
|
||||
ATTACH TABLE four_rows_per_granule;
|
||||
|
||||
SELECT COUNT(*) FROM test.four_rows_per_granule FINAL;
|
||||
SELECT COUNT(*) FROM four_rows_per_granule FINAL;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'four_rows_per_granule' and database='test' and active=1;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'four_rows_per_granule' and database=currentDatabase() and active=1;
|
||||
|
||||
DROP TABLE IF EXISTS test.four_rows_per_granule;
|
||||
DROP TABLE IF EXISTS four_rows_per_granule;
|
||||
|
||||
----- More interesting tests ------
|
||||
SELECT '-----';
|
||||
|
||||
DROP TABLE IF EXISTS test.huge_granularity_small_blocks;
|
||||
DROP TABLE IF EXISTS huge_granularity_small_blocks;
|
||||
|
||||
CREATE TABLE test.huge_granularity_small_blocks (
|
||||
CREATE TABLE huge_granularity_small_blocks (
|
||||
p Date,
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
@ -120,32 +120,32 @@ CREATE TABLE test.huge_granularity_small_blocks (
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
|
||||
INSERT INTO test.huge_granularity_small_blocks (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
INSERT INTO huge_granularity_small_blocks (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
SELECT COUNT(*) FROM test.huge_granularity_small_blocks;
|
||||
SELECT COUNT(*) FROM huge_granularity_small_blocks;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'huge_granularity_small_blocks' and database='test' and active=1;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'huge_granularity_small_blocks' and database=currentDatabase() and active=1;
|
||||
|
||||
INSERT INTO test.huge_granularity_small_blocks (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
INSERT INTO huge_granularity_small_blocks (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 8, 7000, 8000);
|
||||
|
||||
DETACH TABLE test.huge_granularity_small_blocks;
|
||||
DETACH TABLE huge_granularity_small_blocks;
|
||||
|
||||
ATTACH TABLE test.huge_granularity_small_blocks;
|
||||
ATTACH TABLE huge_granularity_small_blocks;
|
||||
|
||||
OPTIMIZE TABLE test.huge_granularity_small_blocks FINAL;
|
||||
OPTIMIZE TABLE huge_granularity_small_blocks FINAL;
|
||||
|
||||
SELECT COUNT(*) FROM test.huge_granularity_small_blocks FINAL;
|
||||
SELECT COUNT(*) FROM huge_granularity_small_blocks FINAL;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'huge_granularity_small_blocks' and database='test' and active=1;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'huge_granularity_small_blocks' and database=currentDatabase() and active=1;
|
||||
|
||||
DROP TABLE IF EXISTS test.huge_granularity_small_blocks;
|
||||
DROP TABLE IF EXISTS huge_granularity_small_blocks;
|
||||
|
||||
----- Some alter tests ----
|
||||
SELECT '-----';
|
||||
|
||||
DROP TABLE IF EXISTS test.adaptive_granularity_alter;
|
||||
DROP TABLE IF EXISTS adaptive_granularity_alter;
|
||||
|
||||
CREATE TABLE test.adaptive_granularity_alter (
|
||||
CREATE TABLE adaptive_granularity_alter (
|
||||
p Date,
|
||||
k UInt64,
|
||||
v1 UInt64,
|
||||
@ -156,43 +156,43 @@ CREATE TABLE test.adaptive_granularity_alter (
|
||||
vertical_merge_algorithm_min_rows_to_activate=0,
|
||||
vertical_merge_algorithm_min_columns_to_activate=0;
|
||||
|
||||
INSERT INTO test.adaptive_granularity_alter (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
INSERT INTO adaptive_granularity_alter (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 2, 3000, 4000), ('2018-05-17', 3, 5000, 6000), ('2018-05-18', 4, 7000, 8000);
|
||||
|
||||
SELECT COUNT(*) FROM test.adaptive_granularity_alter;
|
||||
SELECT COUNT(*) FROM adaptive_granularity_alter;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database='test' and active=1;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database=currentDatabase() and active=1;
|
||||
|
||||
|
||||
ALTER TABLE test.adaptive_granularity_alter MODIFY COLUMN v1 Int16;
|
||||
ALTER TABLE adaptive_granularity_alter MODIFY COLUMN v1 Int16;
|
||||
|
||||
DETACH TABLE test.adaptive_granularity_alter;
|
||||
DETACH TABLE adaptive_granularity_alter;
|
||||
|
||||
ATTACH TABLE test.adaptive_granularity_alter;
|
||||
ATTACH TABLE adaptive_granularity_alter;
|
||||
|
||||
SELECT COUNT(*) FROM test.adaptive_granularity_alter;
|
||||
SELECT COUNT(*) FROM adaptive_granularity_alter;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database='test' and active=1;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database=currentDatabase() and active=1;
|
||||
|
||||
INSERT INTO test.adaptive_granularity_alter (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 42, 42, 42);
|
||||
INSERT INTO adaptive_granularity_alter (p, k, v1, v2) VALUES ('2018-05-15', 5, 1000, 2000), ('2018-05-16', 6, 3000, 4000), ('2018-05-17', 7, 5000, 6000), ('2018-05-19', 42, 42, 42);
|
||||
|
||||
OPTIMIZE TABLE test.adaptive_granularity_alter FINAL;
|
||||
OPTIMIZE TABLE adaptive_granularity_alter FINAL;
|
||||
|
||||
SELECT COUNT(*) FROM test.adaptive_granularity_alter;
|
||||
SELECT COUNT(*) FROM adaptive_granularity_alter;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database='test' and active=1;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database=currentDatabase() and active=1;
|
||||
|
||||
ALTER TABLE test.adaptive_granularity_alter MODIFY COLUMN v2 String;
|
||||
ALTER TABLE adaptive_granularity_alter MODIFY COLUMN v2 String;
|
||||
|
||||
DETACH TABLE test.adaptive_granularity_alter;
|
||||
DETACH TABLE adaptive_granularity_alter;
|
||||
|
||||
ATTACH TABLE test.adaptive_granularity_alter;
|
||||
ATTACH TABLE adaptive_granularity_alter;
|
||||
|
||||
INSERT INTO test.adaptive_granularity_alter (p, k, v1, v2) VALUES ('2018-05-15', 100, 1000, 'aaaa'), ('2018-05-16', 101, 3000, 'bbbb'), ('2018-05-17', 102, 5000, 'cccc'), ('2018-05-19', 103, 7000, 'dddd');
|
||||
INSERT INTO adaptive_granularity_alter (p, k, v1, v2) VALUES ('2018-05-15', 100, 1000, 'aaaa'), ('2018-05-16', 101, 3000, 'bbbb'), ('2018-05-17', 102, 5000, 'cccc'), ('2018-05-19', 103, 7000, 'dddd');
|
||||
|
||||
OPTIMIZE TABLE test.adaptive_granularity_alter FINAL;
|
||||
OPTIMIZE TABLE adaptive_granularity_alter FINAL;
|
||||
|
||||
SELECT k, v2 FROM test.adaptive_granularity_alter WHERE k >= 100 OR k = 42;
|
||||
SELECT k, v2 FROM adaptive_granularity_alter WHERE k >= 100 OR k = 42;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database='test' and active=1;
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database=currentDatabase() and active=1;
|
||||
|
||||
DROP TABLE IF EXISTS test.adaptive_granularity_alter;
|
||||
DROP TABLE IF EXISTS adaptive_granularity_alter;
|
||||
|
@ -1,26 +1,26 @@
|
||||
set send_logs_level = 'none';
|
||||
|
||||
drop table if exists test.ttl;
|
||||
drop table if exists ttl;
|
||||
|
||||
create table test.ttl (d Date, a Int) engine = MergeTree order by a partition by toDayOfMonth(d);
|
||||
alter table test.ttl modify ttl d + interval 1 day;
|
||||
show create table test.ttl;
|
||||
insert into test.ttl values (toDateTime('2000-10-10 00:00:00'), 1);
|
||||
insert into test.ttl values (toDateTime('2000-10-10 00:00:00'), 2);
|
||||
insert into test.ttl values (toDateTime('2100-10-10 00:00:00'), 3);
|
||||
insert into test.ttl values (toDateTime('2100-10-10 00:00:00'), 4);
|
||||
create table ttl (d Date, a Int) engine = MergeTree order by a partition by toDayOfMonth(d);
|
||||
alter table ttl modify ttl d + interval 1 day;
|
||||
show create table ttl;
|
||||
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 1);
|
||||
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 2);
|
||||
insert into ttl values (toDateTime('2100-10-10 00:00:00'), 3);
|
||||
insert into ttl values (toDateTime('2100-10-10 00:00:00'), 4);
|
||||
select sleep(1) format Null; -- wait if very fast merge happen
|
||||
optimize table test.ttl partition 10 final;
|
||||
optimize table ttl partition 10 final;
|
||||
|
||||
select * from test.ttl order by d;
|
||||
select * from ttl order by d;
|
||||
|
||||
alter table test.ttl modify ttl a; -- { serverError 450 }
|
||||
alter table ttl modify ttl a; -- { serverError 450 }
|
||||
|
||||
drop table if exists test.ttl;
|
||||
drop table if exists ttl;
|
||||
|
||||
create table test.ttl (d Date, a Int) engine = MergeTree order by tuple() partition by toDayOfMonth(d);
|
||||
alter table test.ttl modify column a Int ttl d + interval 1 day;
|
||||
desc table test.ttl;
|
||||
alter table test.ttl modify column d Int ttl d + interval 1 day; -- { serverError 44}
|
||||
create table ttl (d Date, a Int) engine = MergeTree order by tuple() partition by toDayOfMonth(d);
|
||||
alter table ttl modify column a Int ttl d + interval 1 day;
|
||||
desc table ttl;
|
||||
alter table ttl modify column d Int ttl d + interval 1 day; -- { serverError 44}
|
||||
|
||||
drop table if exists test.ttl;
|
||||
drop table if exists ttl;
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,3 @@
|
||||
USE test;
|
||||
|
||||
DROP TABLE IF EXISTS ipv6_range;
|
||||
CREATE TABLE ipv6_range(ip IPv6, cidr UInt8) ENGINE = Memory;
|
||||
|
||||
|
@ -1,21 +1,19 @@
|
||||
DROP TABLE IF EXISTS test.src;
|
||||
DROP TABLE IF EXISTS test.view_table;
|
||||
DROP TABLE IF EXISTS test.new_view_table;
|
||||
DROP TABLE IF EXISTS src;
|
||||
DROP TABLE IF EXISTS view_table;
|
||||
DROP TABLE IF EXISTS new_view_table;
|
||||
|
||||
CREATE TABLE test.src (x UInt8) ENGINE = Null;
|
||||
CREATE TABLE src (x UInt8) ENGINE = Null;
|
||||
|
||||
USE test;
|
||||
CREATE MATERIALIZED VIEW view_table Engine = Memory AS SELECT * FROM src;
|
||||
|
||||
CREATE MATERIALIZED VIEW test.view_table Engine = Memory AS SELECT * FROM test.src;
|
||||
|
||||
INSERT INTO test.src VALUES (1), (2), (3);
|
||||
SELECT * FROM test.view_table ORDER BY x;
|
||||
INSERT INTO src VALUES (1), (2), (3);
|
||||
SELECT * FROM view_table ORDER BY x;
|
||||
|
||||
--Check if we can rename the view and if we can still fetch datas
|
||||
|
||||
RENAME TABLE test.view_table TO test.new_view_table;
|
||||
SELECT * FROM test.new_view_table ORDER BY x;
|
||||
RENAME TABLE view_table TO new_view_table;
|
||||
SELECT * FROM new_view_table ORDER BY x;
|
||||
|
||||
DROP TABLE test.src;
|
||||
DROP TABLE IF EXISTS test.view_table;
|
||||
DROP TABLE IF EXISTS test.new_view_table;
|
||||
DROP TABLE src;
|
||||
DROP TABLE IF EXISTS view_table;
|
||||
DROP TABLE IF EXISTS new_view_table;
|
||||
|
@ -1,26 +1,24 @@
|
||||
DROP TABLE IF EXISTS test.src;
|
||||
DROP TABLE IF EXISTS test.dst;
|
||||
DROP TABLE IF EXISTS test.original_mv;
|
||||
DROP TABLE IF EXISTS test.new_mv;
|
||||
DROP TABLE IF EXISTS src;
|
||||
DROP TABLE IF EXISTS dst;
|
||||
DROP TABLE IF EXISTS original_mv;
|
||||
DROP TABLE IF EXISTS new_mv;
|
||||
|
||||
CREATE TABLE test.src (x UInt8) ENGINE = Null;
|
||||
CREATE TABLE test.dst (x UInt8) ENGINE = Memory;
|
||||
CREATE TABLE src (x UInt8) ENGINE = Null;
|
||||
CREATE TABLE dst (x UInt8) ENGINE = Memory;
|
||||
|
||||
USE test;
|
||||
|
||||
CREATE MATERIALIZED VIEW test.original_mv TO dst AS SELECT * FROM src;
|
||||
CREATE MATERIALIZED VIEW original_mv TO dst AS SELECT * FROM src;
|
||||
|
||||
INSERT INTO src VALUES (1), (2);
|
||||
SELECT * FROM test.original_mv ORDER BY x;
|
||||
SELECT * FROM original_mv ORDER BY x;
|
||||
|
||||
RENAME TABLE test.original_mv TO test.new_mv;
|
||||
RENAME TABLE original_mv TO new_mv;
|
||||
|
||||
INSERT INTO src VALUES (3);
|
||||
SELECT * FROM dst ORDER BY x;
|
||||
|
||||
SELECT * FROM test.new_mv ORDER BY x;
|
||||
SELECT * FROM new_mv ORDER BY x;
|
||||
|
||||
DROP TABLE IF EXISTS test.src;
|
||||
DROP TABLE IF EXISTS test.dst;
|
||||
DROP TABLE IF EXISTS test.original_mv;
|
||||
DROP TABLE IF EXISTS test.new_mv;
|
||||
DROP TABLE IF EXISTS src;
|
||||
DROP TABLE IF EXISTS dst;
|
||||
DROP TABLE IF EXISTS original_mv;
|
||||
DROP TABLE IF EXISTS new_mv;
|
||||
|
@ -1,6 +1,5 @@
|
||||
CREATE DATABASE IF NOT EXISTS test;
|
||||
DROP TABLE IF EXISTS test.defaults;
|
||||
CREATE TABLE IF NOT EXISTS test.defaults
|
||||
DROP TABLE IF EXISTS defaults;
|
||||
CREATE TABLE IF NOT EXISTS defaults
|
||||
(
|
||||
param1 Float64,
|
||||
param2 Float64,
|
||||
@ -8,12 +7,15 @@ CREATE TABLE IF NOT EXISTS test.defaults
|
||||
predict1 Float64,
|
||||
predict2 Float64
|
||||
) ENGINE = Memory;
|
||||
insert into test.defaults values (1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2)
|
||||
DROP TABLE IF EXISTS test.model;
|
||||
create table test.model engine = Memory as select stochasticLogisticRegressionState(0.1, 0.0, 1.0, 'SGD')(target, param1, param2) as state from test.defaults;
|
||||
insert into defaults values (1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2),(1,2,1,-1,-2),(-1,-2,-1,1,2)
|
||||
DROP TABLE IF EXISTS model;
|
||||
create table model engine = Memory as select stochasticLogisticRegressionState(0.1, 0.0, 1.0, 'SGD')(target, param1, param2) as state from defaults;
|
||||
|
||||
select ans < 1.1 and ans > 0.9 from
|
||||
(with (select state from test.model) as model select evalMLMethod(model, predict1, predict2) as ans from test.defaults limit 2);
|
||||
(with (select state from model) as model select evalMLMethod(model, predict1, predict2) as ans from defaults limit 2);
|
||||
|
||||
select ans > -0.1 and ans < 0.1 from
|
||||
(with (select state from test.model) as model select evalMLMethod(model, predict1, predict2) as ans from test.defaults limit 2);
|
||||
(with (select state from model) as model select evalMLMethod(model, predict1, predict2) as ans from defaults limit 2);
|
||||
|
||||
DROP TABLE defaults;
|
||||
DROP TABLE model;
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,4 @@
|
||||
-- Must use `test` database and this tables - they configured in dbms/tests/*_dictionary.xml
|
||||
use test;
|
||||
drop table if exists ints;
|
||||
drop table if exists strings;
|
||||
drop table if exists decimals;
|
||||
|
Loading…
Reference in New Issue
Block a user