mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Fix error found by AST Fuzzer
This commit is contained in:
parent
3f0c3602bf
commit
846f2d57af
@ -50,17 +50,3 @@ def test_partially_dropped_tables(started_cluster):
|
||||
)
|
||||
== "0\n"
|
||||
)
|
||||
|
||||
|
||||
def test_live_view_dependency(started_cluster):
|
||||
instance = started_cluster.instances["dummy"]
|
||||
instance.query("CREATE DATABASE a_load_first")
|
||||
instance.query("CREATE DATABASE b_load_second")
|
||||
instance.query(
|
||||
"CREATE TABLE b_load_second.mt (a Int32) Engine=MergeTree order by tuple()"
|
||||
)
|
||||
instance.query(
|
||||
"CREATE LIVE VIEW a_load_first.lv AS SELECT sum(a) FROM b_load_second.mt",
|
||||
settings={"allow_experimental_live_view": 1},
|
||||
)
|
||||
instance.restart_clickhouse()
|
||||
|
@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1, client(
|
||||
name="client2>", log=log
|
||||
) as client2:
|
||||
client1.expect(prompt)
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
client2.send("SET allow_experimental_live_view = 1")
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send(" DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("WATCH test.lv EVENTS")
|
||||
client1.expect("version")
|
||||
client1.expect("1.*" + end_of_block)
|
||||
client2.send("INSERT INTO test.mt VALUES (1),(2),(3)")
|
||||
client1.expect("2.*" + end_of_block)
|
||||
client2.send("INSERT INTO test.mt VALUES (4),(5),(6)")
|
||||
client1.expect("3.*" + end_of_block)
|
||||
# send Ctrl-C
|
||||
client1.send("\x03", eol="")
|
||||
match = client1.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client1.send(client1.command)
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.mt")
|
||||
client1.expect(prompt)
|
@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1, client(
|
||||
name="client2>", log=log
|
||||
) as client2:
|
||||
client1.expect(prompt)
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
client2.send("SET allow_experimental_live_view = 1")
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send(
|
||||
"CREATE LIVE VIEW test.lv WITH REFRESH 1"
|
||||
" AS SELECT value FROM system.events WHERE event = 'OSCPUVirtualTimeMicroseconds'"
|
||||
)
|
||||
client1.expect(prompt)
|
||||
client1.send("WATCH test.lv FORMAT JSONEachRow")
|
||||
client1.expect(r'"_version":' + end_of_block)
|
||||
client1.expect(r'"_version":' + end_of_block)
|
||||
client1.expect(r'"_version":' + end_of_block)
|
||||
# send Ctrl-C
|
||||
client1.send("\x03", eol="")
|
||||
match = client1.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client1.send(client1.command)
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import signal
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1, client(
|
||||
name="client2>", log=log
|
||||
) as client2:
|
||||
client1.expect(prompt)
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
client2.send("SET allow_experimental_live_view = 1")
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send(
|
||||
"CREATE LIVE VIEW test.lv WITH REFRESH 1"
|
||||
" AS SELECT value FROM system.events WHERE event = 'OSCPUVirtualTimeMicroseconds'"
|
||||
)
|
||||
client1.expect(prompt)
|
||||
client1.send("WATCH test.lv FORMAT JSONEachRow")
|
||||
client1.expect(r'"_version":' + end_of_block)
|
||||
client1.expect(r'"_version":' + end_of_block)
|
||||
client1.expect(r'"_version":' + end_of_block)
|
||||
# send Ctrl-C
|
||||
client1.send("\x03", eol="")
|
||||
match = client1.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client1.send(client1.command)
|
||||
client1.expect(prompt)
|
@ -1,73 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1, client(
|
||||
name="client2>", log=log
|
||||
) as client2:
|
||||
client1.expect(prompt)
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
client2.send("SET allow_experimental_live_view = 1")
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP DICTIONARY IF EXITS test.dict")
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send(
|
||||
"CREATE TABLE test.mt (a Int32, b Int32) Engine=MergeTree order by tuple()"
|
||||
)
|
||||
client1.expect(prompt)
|
||||
client1.send(
|
||||
"CREATE DICTIONARY test.dict(a Int32, b Int32) PRIMARY KEY a LAYOUT(FLAT()) "
|
||||
+ "SOURCE(CLICKHOUSE(db 'test' table 'mt')) LIFETIME(1)"
|
||||
)
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE LIVE VIEW test.lv WITH REFRESH 1 AS SELECT * FROM test.dict")
|
||||
client1.expect(prompt)
|
||||
|
||||
client2.send("INSERT INTO test.mt VALUES (1,2)")
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("WATCH test.lv FORMAT JSONEachRow")
|
||||
client1.expect(r'"_version":"1"')
|
||||
|
||||
client2.send("INSERT INTO test.mt VALUES (2,2)")
|
||||
client2.expect(prompt)
|
||||
client1.expect(r'"_version":"2"')
|
||||
|
||||
client2.send("INSERT INTO test.mt VALUES (3,2)")
|
||||
client2.expect(prompt)
|
||||
client1.expect(r'"_version":"3"')
|
||||
|
||||
# send Ctrl-C
|
||||
client1.send("\x03", eol="")
|
||||
match = client1.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client1.send(client1.command)
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP DICTIONARY IF EXISTS test.dict")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1, client(
|
||||
name="client2>", log=log
|
||||
) as client2:
|
||||
client1.expect(prompt)
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
client2.send("SET allow_experimental_live_view = 1")
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("SET live_view_heartbeat_interval=1")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("WATCH test.lv EVENTS FORMAT CSV")
|
||||
client1.expect("Progress: 1.00 rows.*\)")
|
||||
client2.send("INSERT INTO test.mt VALUES (1)")
|
||||
client2.expect(prompt)
|
||||
client1.expect("Progress: 2.00 rows.*\)")
|
||||
client2.send("INSERT INTO test.mt VALUES (2),(3)")
|
||||
client2.expect(prompt)
|
||||
# wait for heartbeat
|
||||
client1.expect("Progress: 3.00 rows.*\)")
|
||||
# send Ctrl-C
|
||||
client1.send("\x03", eol="")
|
||||
match = client1.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client1.send(client1.command)
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.mt")
|
||||
client1.expect(prompt)
|
@ -1,54 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1, client(
|
||||
name="client2>", log=log
|
||||
) as client2:
|
||||
client1.expect(prompt)
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
client2.send("SET allow_experimental_live_view = 1")
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send(" DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("SET live_view_heartbeat_interval=1")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("WATCH test.lv")
|
||||
client1.expect("_version")
|
||||
client1.expect(r"0.*1" + end_of_block)
|
||||
client2.send("INSERT INTO test.mt VALUES (1),(2),(3)")
|
||||
client1.expect(r"6.*2" + end_of_block)
|
||||
# wait for heartbeat
|
||||
client1.expect("Progress: 2.00 rows.*\)")
|
||||
# send Ctrl-C
|
||||
client1.send("\x03", eol="")
|
||||
match = client1.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client1.send(client1.command)
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.mt")
|
||||
client1.expect(prompt)
|
@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
from httpclient import client as http_client
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1:
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send(" DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt")
|
||||
client1.expect(prompt)
|
||||
|
||||
try:
|
||||
with http_client(
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "/?allow_experimental_live_view=1&query=WATCH%20test.lv%20EVENTS",
|
||||
},
|
||||
name="client2>",
|
||||
log=log,
|
||||
) as client2:
|
||||
client2.expect(".*1\n")
|
||||
client1.send("INSERT INTO test.mt VALUES (1),(2),(3)")
|
||||
client1.expect(prompt)
|
||||
client2.expect(".*2\n")
|
||||
finally:
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.mt")
|
||||
client1.expect(prompt)
|
@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
from httpclient import client as http_client
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1:
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send(" DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt")
|
||||
client1.expect(prompt)
|
||||
|
||||
try:
|
||||
with http_client(
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "/?allow_experimental_live_view=1&query=WATCH%20test.lv",
|
||||
},
|
||||
name="client2>",
|
||||
log=log,
|
||||
) as client2:
|
||||
client2.expect(".*0\t1\n")
|
||||
client1.send("INSERT INTO test.mt VALUES (1),(2),(3)")
|
||||
client1.expect(prompt)
|
||||
client2.expect(".*6\t2\n")
|
||||
finally:
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.mt")
|
||||
client1.expect(prompt)
|
@ -1,4 +0,0 @@
|
||||
{"row":{"a":1}}
|
||||
{"row":{"a":2}}
|
||||
{"row":{"a":3}}
|
||||
{"progress":{"read_rows":"3","read_bytes":"36","written_rows":"0","written_bytes":"0","total_rows_to_read":"0","result_rows":"0","result_bytes":"0"}}
|
@ -1,16 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM mt;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT * FROM lv FORMAT JSONEachRowWithProgress;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,6 +0,0 @@
|
||||
{"row":{"sum(a)":"0","_version":"1"}}
|
||||
{"progress":{"read_rows":"1","read_bytes":"16","written_rows":"0","written_bytes":"0","total_rows_to_read":"0","result_rows":"0","result_bytes":"0"}}
|
||||
{"row":{"sum(a)":"6","_version":"2"}}
|
||||
{"progress":{"read_rows":"1","read_bytes":"16","written_rows":"0","written_bytes":"0","total_rows_to_read":"0","result_rows":"0","result_bytes":"0"}}
|
||||
{"row":{"sum(a)":"21","_version":"3"}}
|
||||
{"progress":{"read_rows":"1","read_bytes":"16","written_rows":"0","written_bytes":"0","total_rows_to_read":"0","result_rows":"0","result_bytes":"0"}}
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT sum(a) FROM mt;
|
||||
|
||||
WATCH lv LIMIT 0 FORMAT JSONEachRowWithProgress;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
WATCH lv LIMIT 0 FORMAT JSONEachRowWithProgress;
|
||||
|
||||
INSERT INTO mt VALUES (4),(5),(6);
|
||||
|
||||
WATCH lv LIMIT 0 FORMAT JSONEachRowWithProgress;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,63 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
from httpclient import client as http_client
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1:
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send(" DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt")
|
||||
client1.expect(prompt)
|
||||
|
||||
with http_client(
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "/?allow_experimental_live_view=1&live_view_heartbeat_interval=1&query=WATCH%20test.lv%20EVENTS%20FORMAT%20JSONEachRowWithProgress",
|
||||
},
|
||||
name="client2>",
|
||||
log=log,
|
||||
) as client2:
|
||||
client2.expect(
|
||||
'{"progress":{"read_rows":"1","read_bytes":"8","written_rows":"0","written_bytes":"0","total_rows_to_read":"0","result_rows":"0","result_bytes":"0"}}\n',
|
||||
escape=True,
|
||||
)
|
||||
client2.expect('{"row":{"version":"1"}', escape=True)
|
||||
client2.expect(
|
||||
'{"progress":{"read_rows":"1","read_bytes":"8","written_rows":"0","written_bytes":"0","total_rows_to_read":"0","result_rows":"0","result_bytes":"0"}}',
|
||||
escape=True,
|
||||
)
|
||||
# heartbeat is provided by progress message
|
||||
client2.expect(
|
||||
'{"progress":{"read_rows":"1","read_bytes":"8","written_rows":"0","written_bytes":"0","total_rows_to_read":"0","result_rows":"0","result_bytes":"0"}}',
|
||||
escape=True,
|
||||
)
|
||||
|
||||
client1.send("INSERT INTO test.mt VALUES (1),(2),(3)")
|
||||
client1.expect(prompt)
|
||||
|
||||
client2.expect('{"row":{"version":"2"}}\n', escape=True)
|
||||
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.mt")
|
||||
client1.expect(prompt)
|
@ -1,57 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
from httpclient import client as http_client
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1:
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send(" DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt")
|
||||
client1.expect(prompt)
|
||||
|
||||
with http_client(
|
||||
{
|
||||
"method": "GET",
|
||||
"url": "/?allow_experimental_live_view=1&live_view_heartbeat_interval=1&query=WATCH%20test.lv%20FORMAT%20JSONEachRowWithProgress",
|
||||
},
|
||||
name="client2>",
|
||||
log=log,
|
||||
) as client2:
|
||||
client2.expect(
|
||||
'"progress".*',
|
||||
)
|
||||
client2.expect('{"row":{"sum(a)":"0","_version":"1"}}\n', escape=True)
|
||||
client2.expect('"progress".*\n')
|
||||
# heartbeat is provided by progress message
|
||||
client2.expect('"progress".*\n')
|
||||
|
||||
client1.send("INSERT INTO test.mt VALUES (1),(2),(3)")
|
||||
client1.expect(prompt)
|
||||
|
||||
client2.expect('"progress".*"read_rows":"2".*\n')
|
||||
client2.expect('{"row":{"sum(a)":"6","_version":"2"}}\n', escape=True)
|
||||
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.mt")
|
||||
client1.expect(prompt)
|
@ -1 +0,0 @@
|
||||
1
|
@ -1,11 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
|
||||
CREATE LIVE VIEW lv AS SELECT 1;
|
||||
|
||||
SELECT * FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
@ -1,4 +0,0 @@
|
||||
6 1
|
||||
6 1
|
||||
12 2
|
||||
12 2
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT sum(a) FROM mt;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,2 +0,0 @@
|
||||
5 1
|
||||
10 2
|
@ -1,25 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_analyzer = 1;
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS lv2;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT sum(a) AS sum_a FROM mt PREWHERE a > 1;
|
||||
CREATE LIVE VIEW lv2 AS SELECT sum(number) AS sum_number FROM system.numbers PREWHERE number > 1; -- { serverError 182 }
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *, _version FROM lv;
|
||||
SELECT *, _version FROM lv PREWHERE sum_a > 5; -- { serverError 182 }
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *, _version FROM lv;
|
||||
SELECT *, _version FROM lv PREWHERE sum_a > 10; -- { serverError 182 }
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,18 +0,0 @@
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT a FROM (SELECT a FROM mt);
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,6 +0,0 @@
|
||||
1 hello 2
|
||||
1 hello 2
|
||||
1 hello 3
|
||||
2 hello 3
|
||||
1 hello 3
|
||||
2 hello 3
|
@ -1,30 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS A;
|
||||
DROP TABLE IF EXISTS B;
|
||||
|
||||
CREATE TABLE A (id Int32) Engine=Memory;
|
||||
CREATE TABLE B (id Int32, name String) Engine=Memory;
|
||||
|
||||
CREATE LIVE VIEW lv AS SELECT id, name FROM ( SELECT A.id, B.name FROM A as A, B as B WHERE A.id = B.id );
|
||||
|
||||
SELECT * FROM lv;
|
||||
|
||||
INSERT INTO A VALUES (1);
|
||||
INSERT INTO B VALUES (1, 'hello');
|
||||
|
||||
SELECT *,_version FROM lv ORDER BY id;
|
||||
SELECT *,_version FROM lv ORDER BY id;
|
||||
|
||||
INSERT INTO A VALUES (2)
|
||||
INSERT INTO B VALUES (2, 'hello')
|
||||
|
||||
SELECT *,_version FROM lv ORDER BY id;
|
||||
SELECT *,_version FROM lv ORDER BY id;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE A;
|
||||
DROP TABLE B;
|
@ -1,6 +0,0 @@
|
||||
1 hello 2
|
||||
1 hello 2
|
||||
1 hello 3
|
||||
2 hello 3
|
||||
1 hello 3
|
||||
2 hello 3
|
@ -1,30 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS A;
|
||||
DROP TABLE IF EXISTS B;
|
||||
|
||||
CREATE TABLE A (id Int32) Engine=Memory;
|
||||
CREATE TABLE B (id Int32, name String) Engine=Memory;
|
||||
|
||||
CREATE LIVE VIEW lv AS SELECT id, name FROM ( SELECT A.id, B.name FROM A, B WHERE A.id = B.id);
|
||||
|
||||
SELECT * FROM lv;
|
||||
|
||||
INSERT INTO A VALUES (1);
|
||||
INSERT INTO B VALUES (1, 'hello');
|
||||
|
||||
SELECT *,_version FROM lv ORDER BY id;
|
||||
SELECT *,_version FROM lv ORDER BY id;
|
||||
|
||||
INSERT INTO A VALUES (2)
|
||||
INSERT INTO B VALUES (2, 'hello')
|
||||
|
||||
SELECT *,_version FROM lv ORDER BY id;
|
||||
SELECT *,_version FROM lv ORDER BY id;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE A;
|
||||
DROP TABLE B;
|
@ -1,18 +0,0 @@
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT a FROM ( SELECT * FROM ( SELECT a FROM (SELECT a FROM mt) ) );
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,4 +0,0 @@
|
||||
6 1
|
||||
6 1
|
||||
12 2
|
||||
12 2
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM ( SELECT sum(a) FROM ( SELECT a FROM (SELECT a FROM mt) ) );
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,4 +0,0 @@
|
||||
6 1
|
||||
6 1
|
||||
12 2
|
||||
12 2
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM ( SELECT sum(boo.x) FROM ( SELECT foo.x FROM (SELECT a AS x FROM mt) AS foo) AS boo );
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,18 +0,0 @@
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT foo.x FROM (SELECT a AS x FROM mt) AS foo;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,4 +0,0 @@
|
||||
6 1
|
||||
6 1
|
||||
12 2
|
||||
12 2
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT sum(a) FROM (SELECT a FROM mt);
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,4 +0,0 @@
|
||||
6 1
|
||||
6 1
|
||||
12 2
|
||||
12 2
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM (SELECT sum(a) FROM mt);
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,2 +0,0 @@
|
||||
6
|
||||
21
|
@ -1,20 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM mt;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT sum(a) FROM lv;
|
||||
|
||||
INSERT INTO mt VALUES (4),(5),(6);
|
||||
|
||||
SELECT sum(a) FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,11 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM mt;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,3 +0,0 @@
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
@ -1,16 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM mt;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
SELECT *,_version FROM lv;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,3 +0,0 @@
|
||||
1
|
||||
2
|
||||
3
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT sum(a) FROM mt;
|
||||
|
||||
WATCH lv EVENTS LIMIT 0;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
WATCH lv EVENTS LIMIT 0;
|
||||
|
||||
INSERT INTO mt VALUES (4),(5),(6);
|
||||
|
||||
WATCH lv EVENTS LIMIT 0;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,3 +0,0 @@
|
||||
0 1
|
||||
6 2
|
||||
21 3
|
@ -1,22 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS mt;
|
||||
|
||||
CREATE TABLE mt (a Int32) Engine=MergeTree order by tuple();
|
||||
CREATE LIVE VIEW lv AS SELECT sum(a) FROM mt;
|
||||
|
||||
WATCH lv LIMIT 0;
|
||||
|
||||
INSERT INTO mt VALUES (1),(2),(3);
|
||||
|
||||
WATCH lv LIMIT 0;
|
||||
|
||||
INSERT INTO mt VALUES (4),(5),(6);
|
||||
|
||||
WATCH lv LIMIT 0;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE mt;
|
@ -1,84 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1, client(
|
||||
name="client2>", log=log
|
||||
) as client2:
|
||||
client1.expect(prompt)
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
client2.send("SET allow_experimental_live_view = 1")
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send(
|
||||
"CREATE TABLE test.mt (time DateTime, location String, temperature UInt32) Engine=MergeTree order by tuple()"
|
||||
)
|
||||
client1.expect(prompt)
|
||||
client1.send(
|
||||
"CREATE LIVE VIEW test.lv AS SELECT toStartOfDay(time) AS day, location, avg(temperature) FROM test.mt GROUP BY day, location ORDER BY day, location"
|
||||
)
|
||||
client1.expect(prompt)
|
||||
client1.send("WATCH test.lv FORMAT CSVWithNames")
|
||||
client2.send(
|
||||
"INSERT INTO test.mt VALUES ('2019-01-01 00:00:00','New York',60),('2019-01-01 00:10:00','New York',70)"
|
||||
)
|
||||
client2.expect(prompt)
|
||||
client1.expect(r'"2019-01-01 00:00:00","New York",65')
|
||||
client2.send(
|
||||
"INSERT INTO test.mt VALUES ('2019-01-01 00:00:00','Moscow',30),('2019-01-01 00:10:00', 'Moscow', 40)"
|
||||
)
|
||||
client2.expect(prompt)
|
||||
client1.expect(r'"2019-01-01 00:00:00","Moscow",35')
|
||||
client1.expect(r'"2019-01-01 00:00:00","New York",65')
|
||||
client2.send(
|
||||
"INSERT INTO test.mt VALUES ('2019-01-02 00:00:00','New York',50),('2019-01-02 00:10:00','New York',60)"
|
||||
)
|
||||
client2.expect(prompt)
|
||||
client1.expect(r'"2019-01-01 00:00:00","Moscow",35')
|
||||
client1.expect(r'"2019-01-01 00:00:00","New York",65')
|
||||
client1.expect(r'"2019-01-02 00:00:00","New York",55')
|
||||
client2.send(
|
||||
"INSERT INTO test.mt VALUES ('2019-01-02 00:00:00','Moscow',20),('2019-01-02 00:10:00', 'Moscow', 30)"
|
||||
)
|
||||
client2.expect(prompt)
|
||||
client1.expect(r'"2019-01-01 00:00:00","Moscow",35')
|
||||
client1.expect(r'"2019-01-01 00:00:00","New York",65')
|
||||
client1.expect(r'"2019-01-02 00:00:00","Moscow",25')
|
||||
client1.expect(r'"2019-01-02 00:00:00","New York",55')
|
||||
client2.send(
|
||||
"INSERT INTO test.mt VALUES ('2019-01-02 00:03:00','New York',40),('2019-01-02 00:06:00','New York',30)"
|
||||
)
|
||||
client2.expect(prompt)
|
||||
client1.expect(r'"2019-01-01 00:00:00","Moscow",35')
|
||||
client1.expect(r'"2019-01-01 00:00:00","New York",65')
|
||||
client1.expect(r'"2019-01-02 00:00:00","Moscow",25')
|
||||
client1.expect(r'"2019-01-02 00:00:00","New York",45')
|
||||
# send Ctrl-C
|
||||
client1.send("\x03", eol="")
|
||||
match = client1.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client1.send(client1.command)
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.mt")
|
||||
client1.expect(prompt)
|
@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1, client(
|
||||
name="client2>", log=log
|
||||
) as client2:
|
||||
client1.expect(prompt)
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
client2.send("SET allow_experimental_live_view = 1")
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("WATCH test.lv")
|
||||
client1.expect("_version")
|
||||
client1.expect(r"0.*1" + end_of_block)
|
||||
client2.send("INSERT INTO test.mt VALUES (1),(2),(3)")
|
||||
client1.expect(r"6.*2" + end_of_block)
|
||||
client2.expect(prompt)
|
||||
client2.send("INSERT INTO test.mt VALUES (4),(5),(6)")
|
||||
client1.expect(r"21.*3" + end_of_block)
|
||||
client2.expect(prompt)
|
||||
for i in range(1, 129):
|
||||
client2.send("INSERT INTO test.mt VALUES (1)")
|
||||
client1.expect(r"%d.*%d" % (21 + i, 3 + i) + end_of_block)
|
||||
client2.expect(prompt)
|
||||
# send Ctrl-C
|
||||
client1.send("\x03", eol="")
|
||||
match = client1.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client1.send(client1.command)
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.mt")
|
||||
client1.expect(prompt)
|
@ -1,60 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1, client(
|
||||
name="client2>", log=log
|
||||
) as client2:
|
||||
client1.expect(prompt)
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
client2.send("SET allow_experimental_live_view = 1")
|
||||
client2.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send(" DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()")
|
||||
client1.expect(prompt)
|
||||
client1.send(
|
||||
"CREATE LIVE VIEW test.lv AS SELECT * FROM ( SELECT sum(A.a) FROM (SELECT * FROM test.mt) AS A )"
|
||||
)
|
||||
client1.expect(prompt)
|
||||
client1.send("WATCH test.lv")
|
||||
client1.expect("_version")
|
||||
client1.expect(r"0.*1" + end_of_block)
|
||||
client2.send("INSERT INTO test.mt VALUES (1),(2),(3)")
|
||||
client1.expect(r"6.*2" + end_of_block)
|
||||
client2.expect(prompt)
|
||||
client2.send("INSERT INTO test.mt VALUES (4),(5),(6)")
|
||||
client1.expect(r"21.*3" + end_of_block)
|
||||
client2.expect(prompt)
|
||||
for i in range(1, 129):
|
||||
client2.send("INSERT INTO test.mt VALUES (1)")
|
||||
client1.expect(r"%d.*%d" % (21 + i, 3 + i) + end_of_block)
|
||||
client2.expect(prompt)
|
||||
# send Ctrl-C
|
||||
client1.send("\x03", eol="")
|
||||
match = client1.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client1.send(client1.command)
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE test.mt")
|
||||
client1.expect(prompt)
|
@ -1,88 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
import threading
|
||||
import queue as queue
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
|
||||
|
||||
CLICKHOUSE_CLIENT = os.environ.get("CLICKHOUSE_CLIENT")
|
||||
CLICKHOUSE_CURL = os.environ.get("CLICKHOUSE_CURL")
|
||||
CLICKHOUSE_URL = os.environ.get("CLICKHOUSE_URL")
|
||||
|
||||
|
||||
def send_query(query):
|
||||
cmd = list(CLICKHOUSE_CLIENT.split())
|
||||
cmd += ["--query", query]
|
||||
# print(cmd)
|
||||
return subprocess.Popen(
|
||||
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
).stdout
|
||||
|
||||
|
||||
def send_query_in_process_group(query):
|
||||
cmd = list(CLICKHOUSE_CLIENT.split())
|
||||
cmd += ["--query", query]
|
||||
# print(cmd)
|
||||
return subprocess.Popen(
|
||||
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, preexec_fn=os.setsid
|
||||
)
|
||||
|
||||
|
||||
def read_lines_and_push_to_queue(pipe, queue):
|
||||
try:
|
||||
for line in iter(pipe.readline, ""):
|
||||
line = line.strip()
|
||||
print(line)
|
||||
sys.stdout.flush()
|
||||
queue.put(line)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
queue.put(None)
|
||||
|
||||
|
||||
def test():
|
||||
send_query("DROP TABLE IF EXISTS test.lv").read()
|
||||
send_query("DROP TABLE IF EXISTS test.mt").read()
|
||||
send_query(
|
||||
"CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()"
|
||||
).read()
|
||||
send_query("CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt").read()
|
||||
|
||||
q = queue.Queue()
|
||||
p = send_query_in_process_group("WATCH test.lv")
|
||||
thread = threading.Thread(target=read_lines_and_push_to_queue, args=(p.stdout, q))
|
||||
thread.start()
|
||||
|
||||
line = q.get()
|
||||
print(line)
|
||||
assert line == "0\t1"
|
||||
|
||||
send_query("INSERT INTO test.mt VALUES (1),(2),(3)").read()
|
||||
line = q.get()
|
||||
print(line)
|
||||
assert line == "6\t2"
|
||||
|
||||
send_query("INSERT INTO test.mt VALUES (4),(5),(6)").read()
|
||||
line = q.get()
|
||||
print(line)
|
||||
assert line == "21\t3"
|
||||
|
||||
# Send Ctrl+C to client.
|
||||
os.killpg(os.getpgid(p.pid), signal.SIGINT)
|
||||
# This insert shouldn't affect lv.
|
||||
send_query("INSERT INTO test.mt VALUES (7),(8),(9)").read()
|
||||
line = q.get()
|
||||
print(line)
|
||||
assert line is None
|
||||
|
||||
send_query("DROP TABLE if exists test.lv").read()
|
||||
send_query("DROP TABLE if exists test.lv").read()
|
||||
|
||||
thread.join()
|
||||
|
||||
|
||||
test()
|
@ -1,7 +0,0 @@
|
||||
0 1
|
||||
0 1
|
||||
6 2
|
||||
6 2
|
||||
21 3
|
||||
21 3
|
||||
None
|
@ -1,70 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
import threading
|
||||
import queue as queue
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
CLICKHOUSE_CLIENT = os.environ.get("CLICKHOUSE_CLIENT")
|
||||
CLICKHOUSE_CURL = os.environ.get("CLICKHOUSE_CURL")
|
||||
CLICKHOUSE_URL = os.environ.get("CLICKHOUSE_URL")
|
||||
|
||||
|
||||
def send_query(query):
|
||||
cmd = list(CLICKHOUSE_CLIENT.split())
|
||||
cmd += ["--query", query]
|
||||
# print(cmd)
|
||||
return subprocess.Popen(
|
||||
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
).stdout
|
||||
|
||||
|
||||
def send_http_query(query):
|
||||
cmd = list(CLICKHOUSE_CURL.split()) # list(['curl', '-sSN', '--max-time', '10'])
|
||||
cmd += ["-sSN", CLICKHOUSE_URL, "-d", query]
|
||||
return subprocess.Popen(
|
||||
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
).stdout
|
||||
|
||||
|
||||
def read_lines_and_push_to_queue(pipe, queue):
|
||||
for line in iter(pipe.readline, ""):
|
||||
line = line.strip()
|
||||
print(line)
|
||||
sys.stdout.flush()
|
||||
queue.put(line)
|
||||
|
||||
queue.put(None)
|
||||
|
||||
|
||||
def test():
|
||||
send_query("DROP TABLE IF EXISTS test.lv").read()
|
||||
send_query("DROP TABLE IF EXISTS test.mt").read()
|
||||
send_query(
|
||||
"CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()"
|
||||
).read()
|
||||
send_query("CREATE LIVE VIEW test.lv AS SELECT sum(a) FROM test.mt").read()
|
||||
|
||||
q = queue.Queue()
|
||||
pipe = send_http_query("WATCH test.lv")
|
||||
thread = threading.Thread(target=read_lines_and_push_to_queue, args=(pipe, q))
|
||||
thread.start()
|
||||
|
||||
line = q.get()
|
||||
print(line)
|
||||
assert line == "0\t1"
|
||||
|
||||
send_query("INSERT INTO test.mt VALUES (1),(2),(3)").read()
|
||||
line = q.get()
|
||||
print(line)
|
||||
assert line == "6\t2"
|
||||
|
||||
send_query("DROP TABLE if exists test.lv").read()
|
||||
send_query("DROP TABLE if exists test.lv").read()
|
||||
|
||||
thread.join()
|
||||
|
||||
|
||||
test()
|
@ -1,4 +0,0 @@
|
||||
0 1
|
||||
0 1
|
||||
6 2
|
||||
6 2
|
@ -1 +0,0 @@
|
||||
1 String
|
@ -1,57 +0,0 @@
|
||||
-- Tags: no-parallel
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
DROP TABLE IF EXISTS v;
|
||||
DROP TABLE IF EXISTS lv;
|
||||
|
||||
CREATE TABLE t1 (key Int) Engine=Memory;
|
||||
CREATE TABLE t2 AS t1;
|
||||
DROP TABLE t2;
|
||||
CREATE TABLE t2 Engine=Memory AS t1;
|
||||
DROP TABLE t2;
|
||||
CREATE TABLE t2 AS t1 Engine=Memory;
|
||||
DROP TABLE t2;
|
||||
CREATE TABLE t3 AS numbers(10);
|
||||
DROP TABLE t3;
|
||||
|
||||
-- live view
|
||||
SET allow_experimental_live_view=1;
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM t1;
|
||||
CREATE TABLE t3 AS lv; -- { serverError 80 }
|
||||
DROP TABLE lv;
|
||||
|
||||
-- view
|
||||
CREATE VIEW v AS SELECT * FROM t1;
|
||||
CREATE TABLE t3 AS v; -- { serverError 80 }
|
||||
DROP TABLE v;
|
||||
|
||||
-- dictionary
|
||||
DROP DICTIONARY IF EXISTS dict;
|
||||
DROP DATABASE if exists test_01056_dict_data;
|
||||
CREATE DATABASE test_01056_dict_data;
|
||||
CREATE TABLE test_01056_dict_data.dict_data (key Int, value UInt16) Engine=Memory();
|
||||
CREATE DICTIONARY dict
|
||||
(
|
||||
`key` UInt64,
|
||||
`value` UInt16
|
||||
)
|
||||
PRIMARY KEY key
|
||||
SOURCE(CLICKHOUSE(
|
||||
HOST '127.0.0.1' PORT tcpPort()
|
||||
TABLE 'dict_data' DB 'test_01056_dict_data' USER 'default' PASSWORD ''))
|
||||
LIFETIME(MIN 0 MAX 0)
|
||||
LAYOUT(SPARSE_HASHED());
|
||||
CREATE TABLE t3 AS dict; -- { serverError 80 }
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
DROP DICTIONARY dict;
|
||||
DROP TABLE test_01056_dict_data.dict_data;
|
||||
|
||||
DROP DATABASE test_01056_dict_data;
|
||||
|
||||
CREATE TABLE t1 (x String) ENGINE = Memory AS SELECT 1;
|
||||
SELECT x, toTypeName(x) FROM t1;
|
||||
DROP TABLE t1;
|
@ -1,12 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
DROP TABLE IF EXISTS test;
|
||||
DROP TABLE IF EXISTS lv;
|
||||
CREATE TABLE test (n Int8) ENGINE = Memory;
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM test;
|
||||
DETACH TABLE lv;
|
||||
INSERT INTO test VALUES (42);
|
||||
DROP TABLE test;
|
||||
ATTACH TABLE lv;
|
||||
DROP TABLE lv;
|
@ -1,13 +0,0 @@
|
||||
CREATE DICTIONARY test_01190.dict\n(\n `key` UInt64 DEFAULT 0,\n `col` UInt8 DEFAULT 1\n)\nPRIMARY KEY key\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT 9000 USER \'default\' TABLE \'table_for_dict\' PASSWORD \'[HIDDEN]\' DB \'test_01190\'))\nLIFETIME(MIN 1 MAX 10)\nLAYOUT(FLAT())
|
||||
CREATE DICTIONARY test_01190.dict\n(\n `key` UInt64 DEFAULT 0,\n `col` UInt8 DEFAULT 1\n)\nPRIMARY KEY key\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT 9000 USER \'default\' TABLE \'table_for_dict\' PASSWORD \'[HIDDEN]\' DB \'test_01190\'))\nLIFETIME(MIN 1 MAX 10)\nLAYOUT(FLAT())
|
||||
CREATE TABLE test_01190.log\n(\n `s` String\n)\nENGINE = Log
|
||||
CREATE TABLE test_01190.log\n(\n `s` String\n)\nENGINE = Log
|
||||
test
|
||||
CREATE TABLE test_01190.mt\n(\n `key` Array(UInt8),\n `s` String,\n `n` UInt64,\n `d` Date MATERIALIZED \'2000-01-01\'\n)\nENGINE = MergeTree(d, (key, s, n), 1)
|
||||
[1,2] Hello 2
|
||||
CREATE TABLE test_01190.mt\n(\n `key` Array(UInt8),\n `s` String,\n `n` UInt64,\n `d` Date\n)\nENGINE = MergeTree(d, (key, s, n), 1)
|
||||
CREATE MATERIALIZED VIEW test_01190.mv\n(\n `s` String\n)\nENGINE = Null AS\nSELECT *\nFROM test_01190.log
|
||||
CREATE MATERIALIZED VIEW test_01190.mv\n(\n `s` String\n)\nENGINE = Null AS\nSELECT *\nFROM test_01190.log
|
||||
CREATE MATERIALIZED VIEW test_01190.mv\n(\n `key` Array(UInt8),\n `s` String,\n `n` UInt64,\n `d` Date\n)\nENGINE = Null AS\nSELECT *\nFROM test_01190.mt
|
||||
CREATE LIVE VIEW test_01190.lv\n(\n `1` UInt8\n) AS\nSELECT 1
|
||||
CREATE LIVE VIEW test_01190.lv\n(\n `1` UInt8\n) AS\nSELECT 1
|
@ -1,60 +0,0 @@
|
||||
-- Tags: no-parallel
|
||||
|
||||
DROP DATABASE IF EXISTS test_01190;
|
||||
set allow_deprecated_database_ordinary=1;
|
||||
set allow_deprecated_syntax_for_merge_tree=1;
|
||||
CREATE DATABASE test_01190 ENGINE=Ordinary; -- Full ATTACH requires UUID with Atomic
|
||||
USE test_01190;
|
||||
|
||||
CREATE TABLE test_01190.table_for_dict (key UInt64, col UInt8) ENGINE = Memory;
|
||||
|
||||
CREATE DICTIONARY test_01190.dict (key UInt64 DEFAULT 0, col UInt8 DEFAULT 1) PRIMARY KEY key SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'test_01190')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT());
|
||||
|
||||
SHOW CREATE DICTIONARY test_01190.dict;
|
||||
|
||||
DETACH DICTIONARY test_01190.dict;
|
||||
ATTACH TABLE test_01190.dict; -- { serverError 80 }
|
||||
-- Full ATTACH syntax is not allowed for dictionaries
|
||||
ATTACH DICTIONARY test_01190.dict (key UInt64 DEFAULT 0, col UInt8 DEFAULT 42) PRIMARY KEY key SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'test_01190')) LIFETIME(MIN 1 MAX 100) LAYOUT(FLAT()); -- { clientError 62 }
|
||||
ATTACH DICTIONARY test_01190.dict;
|
||||
SHOW CREATE DICTIONARY test_01190.dict;
|
||||
|
||||
CREATE TABLE log ENGINE = Log AS SELECT 'test' AS s;
|
||||
SHOW CREATE log;
|
||||
DETACH TABLE log;
|
||||
ATTACH DICTIONARY log; -- { serverError 80 }
|
||||
ATTACH TABLE log (s String) ENGINE = Log();
|
||||
SHOW CREATE log;
|
||||
SELECT * FROM log;
|
||||
|
||||
DROP TABLE IF EXISTS mt;
|
||||
CREATE TABLE mt (key Array(UInt8), s String, n UInt64, d Date MATERIALIZED '2000-01-01') ENGINE = MergeTree(d, (key, s, n), 1);
|
||||
INSERT INTO mt VALUES ([1, 2], 'Hello', 2);
|
||||
DETACH TABLE mt;
|
||||
ATTACH TABLE mt (key Array(UInt8), s String, n UInt64, d Date MATERIALIZED '2000-01-01') ENGINE = MergeTree ORDER BY (key, s, n) PARTITION BY toYYYYMM(d); -- { serverError 342 }
|
||||
ATTACH TABLE mt (key Array(UInt8), s String, n UInt64, d Date MATERIALIZED '2000-01-01') ENGINE = MergeTree(d, (key, s, n), 1);
|
||||
SHOW CREATE mt;
|
||||
SELECT * FROM mt;
|
||||
DETACH TABLE mt;
|
||||
ATTACH TABLE mt (key Array(UInt8), s String, n UInt64, d Date) ENGINE = MergeTree(d, (key, s, n), 1); -- It works (with Ordinary database), but probably it shouldn't
|
||||
SHOW CREATE mt;
|
||||
|
||||
CREATE MATERIALIZED VIEW mv ENGINE = Null AS SELECT * FROM log;
|
||||
SHOW CREATE mv;
|
||||
DETACH VIEW mv;
|
||||
ATTACH MATERIALIZED VIEW mv ENGINE = Null AS SELECT * FROM log;
|
||||
SHOW CREATE mv;
|
||||
DETACH VIEW mv;
|
||||
ATTACH MATERIALIZED VIEW mv ENGINE = Null AS SELECT * FROM mt; -- It works (with Ordinary database), but probably it shouldn't
|
||||
SHOW CREATE mv;
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
CREATE LIVE VIEW lv AS SELECT 1;
|
||||
SHOW CREATE lv;
|
||||
DETACH VIEW lv;
|
||||
ATTACH LIVE VIEW lv AS SELECT 1;
|
||||
SHOW CREATE lv;
|
||||
|
||||
DROP DATABASE test_01190;
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
2020-01-01
|
||||
2020-01-01
|
||||
2020-01-02
|
||||
2020-01-02
|
@ -1,23 +0,0 @@
|
||||
-- Tags: distributed, no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
set insert_distributed_sync = 1;
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS visits;
|
||||
DROP TABLE IF EXISTS visits_layer;
|
||||
|
||||
CREATE TABLE visits(StartDate Date) ENGINE MergeTree ORDER BY(StartDate);
|
||||
CREATE TABLE visits_layer(StartDate Date) ENGINE Distributed(test_cluster_two_shards_localhost, currentDatabase(), 'visits', rand());
|
||||
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM visits_layer ORDER BY StartDate;
|
||||
|
||||
INSERT INTO visits_layer (StartDate) VALUES ('2020-01-01');
|
||||
INSERT INTO visits_layer (StartDate) VALUES ('2020-01-02');
|
||||
|
||||
SELECT * FROM lv;
|
||||
|
||||
DROP TABLE visits;
|
||||
DROP TABLE visits_layer;
|
||||
|
||||
DROP TABLE lv;
|
@ -1,8 +0,0 @@
|
||||
2020-01-01
|
||||
2020-01-01
|
||||
2020-01-02
|
||||
2020-01-02
|
||||
2020-01-01
|
||||
2020-01-01
|
||||
2020-01-02
|
||||
2020-01-02
|
@ -1,25 +0,0 @@
|
||||
-- Tags: distributed, no-replicated-database, no-parallel, no-fasttest, no-random-settings
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS visits;
|
||||
DROP TABLE IF EXISTS visits_layer;
|
||||
|
||||
CREATE TABLE visits (StartDate Date) ENGINE MergeTree ORDER BY(StartDate);
|
||||
CREATE TABLE visits_layer (StartDate Date) ENGINE Distributed(test_cluster_two_shards_localhost, currentDatabase(), 'visits', rand());
|
||||
|
||||
CREATE LIVE VIEW lv AS SELECT * FROM visits_layer ORDER BY StartDate;
|
||||
|
||||
CREATE TABLE visits_layer_lv (StartDate Date) ENGINE Distributed(test_cluster_two_shards_localhost, currentDatabase(), 'lv', rand());
|
||||
|
||||
INSERT INTO visits_layer (StartDate) VALUES ('2020-01-01');
|
||||
INSERT INTO visits_layer (StartDate) VALUES ('2020-01-02');
|
||||
|
||||
SELECT * FROM visits_layer_lv;
|
||||
|
||||
DROP TABLE visits;
|
||||
DROP TABLE visits_layer;
|
||||
|
||||
DROP TABLE lv;
|
||||
DROP TABLE visits_layer_lv;
|
@ -1,4 +0,0 @@
|
||||
2020-01-01
|
||||
2020-01-01
|
||||
2020-01-02
|
||||
2020-01-02
|
@ -1,23 +0,0 @@
|
||||
-- Tags: distributed, no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
SET allow_experimental_live_view = 1;
|
||||
SET insert_distributed_sync = 1;
|
||||
|
||||
DROP TABLE IF EXISTS lv;
|
||||
DROP TABLE IF EXISTS visits;
|
||||
DROP TABLE IF EXISTS visits_layer;
|
||||
|
||||
CREATE TABLE visits(StartDate Date) ENGINE MergeTree ORDER BY(StartDate);
|
||||
CREATE TABLE visits_layer(StartDate Date) ENGINE Distributed(test_cluster_two_shards_localhost, currentDatabase(), 'visits', rand());
|
||||
|
||||
CREATE LIVE VIEW lv AS SELECT foo.x FROM (SELECT StartDate AS x FROM visits_layer) AS foo ORDER BY foo.x;
|
||||
|
||||
INSERT INTO visits_layer (StartDate) VALUES ('2020-01-01');
|
||||
INSERT INTO visits_layer (StartDate) VALUES ('2020-01-02');
|
||||
|
||||
SELECT * FROM lv;
|
||||
|
||||
DROP TABLE visits;
|
||||
DROP TABLE visits_layer;
|
||||
|
||||
DROP TABLE lv;
|
@ -1,87 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import signal
|
||||
|
||||
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.insert(0, os.path.join(CURDIR, "helpers"))
|
||||
|
||||
from client import client, prompt, end_of_block
|
||||
|
||||
log = None
|
||||
# uncomment the line below for debugging
|
||||
# log=sys.stdout
|
||||
|
||||
with client(name="client1>", log=log) as client1, client(
|
||||
name="client2>", log=log
|
||||
) as client2, client(name="client3>", log=log) as client3:
|
||||
client1.expect(prompt)
|
||||
client2.expect(prompt)
|
||||
client3.expect(prompt)
|
||||
|
||||
client1.send("SET allow_experimental_live_view = 1")
|
||||
client1.expect(prompt)
|
||||
client3.send("SET allow_experimental_live_view = 1")
|
||||
client3.expect(prompt)
|
||||
|
||||
client1.send("DROP TABLE IF EXISTS test.lv")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE IF EXISTS test.lv_sums")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE IF EXISTS test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send("DROP TABLE IF EXISTS test.sums")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()")
|
||||
client1.expect(prompt)
|
||||
client1.send("CREATE LIVE VIEW test.lv AS SELECT sum(a) AS s FROM test.mt")
|
||||
client1.expect(prompt)
|
||||
client1.send(
|
||||
"CREATE TABLE test.sums (s Int32, version Int32) Engine=MergeTree ORDER BY tuple()"
|
||||
)
|
||||
client1.expect(prompt)
|
||||
client3.send(
|
||||
"CREATE LIVE VIEW test.lv_sums AS SELECT * FROM test.sums ORDER BY version"
|
||||
)
|
||||
client3.expect(prompt)
|
||||
|
||||
client3.send("WATCH test.lv_sums FORMAT CSVWithNames")
|
||||
|
||||
client1.send("INSERT INTO test.sums WATCH test.lv")
|
||||
client1.expect(r"INSERT INTO")
|
||||
|
||||
client3.expect("0,1.*\n")
|
||||
|
||||
client2.send("INSERT INTO test.mt VALUES (1),(2),(3)")
|
||||
client2.expect(prompt)
|
||||
client3.expect("6,2.*\n")
|
||||
|
||||
client2.send("INSERT INTO test.mt VALUES (4),(5),(6)")
|
||||
client2.expect(prompt)
|
||||
client3.expect("21,3.*\n")
|
||||
|
||||
# send Ctrl-C
|
||||
client3.send("\x03", eol="")
|
||||
match = client3.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client3.send(client3.command)
|
||||
client3.expect(prompt)
|
||||
|
||||
# send Ctrl-C
|
||||
client1.send("\x03", eol="")
|
||||
match = client1.expect("(%s)|([#\$] )" % prompt)
|
||||
if match.groups()[1]:
|
||||
client1.send(client1.command)
|
||||
client1.expect(prompt)
|
||||
|
||||
client2.send("DROP TABLE test.lv")
|
||||
client2.expect(prompt)
|
||||
client2.send("DROP TABLE test.lv_sums")
|
||||
client2.expect(prompt)
|
||||
client2.send("DROP TABLE test.sums")
|
||||
client2.expect(prompt)
|
||||
client2.send("DROP TABLE test.mt")
|
||||
client2.expect(prompt)
|
@ -1 +0,0 @@
|
||||
ALTER LIVE VIEW live1 REFRESH
|
@ -1,15 +0,0 @@
|
||||
-- Tags: no-replicated-database, no-parallel, no-fasttest
|
||||
|
||||
CREATE TABLE test0 (
|
||||
c0 UInt64
|
||||
) ENGINE = MergeTree() PARTITION BY c0 ORDER BY c0;
|
||||
|
||||
SET allow_experimental_live_view=1;
|
||||
|
||||
CREATE LIVE VIEW live1 AS SELECT * FROM test0;
|
||||
|
||||
select 'ALTER LIVE VIEW live1 REFRESH';
|
||||
ALTER LIVE VIEW live1 REFRESH; -- success
|
||||
|
||||
DROP TABLE test0;
|
||||
DROP VIEW live1;
|
@ -1,7 +0,0 @@
|
||||
CREATE VIEW test_1602.v\n(\n `EventDate` DateTime,\n `CounterID` UInt32,\n `UserID` UInt32\n) AS\nSELECT *\nFROM test_1602.tbl
|
||||
CREATE MATERIALIZED VIEW test_1602.vv\n(\n `EventDate` DateTime,\n `CounterID` UInt32,\n `UserID` UInt32\n)\nENGINE = MergeTree\nPARTITION BY toYYYYMM(EventDate)\nORDER BY (CounterID, EventDate, intHash32(UserID))\nSETTINGS index_granularity = 8192 AS\nSELECT *\nFROM test_1602.tbl
|
||||
CREATE LIVE VIEW test_1602.vvv\n(\n `EventDate` DateTime,\n `CounterID` UInt32,\n `UserID` UInt32\n) AS\nSELECT *\nFROM test_1602.tbl
|
||||
CREATE VIEW test_1602.VIEW\n(\n `EventDate` DateTime,\n `CounterID` UInt32,\n `UserID` UInt32\n) AS\nSELECT *\nFROM test_1602.tbl
|
||||
CREATE VIEW test_1602.DATABASE\n(\n `EventDate` DateTime,\n `CounterID` UInt32,\n `UserID` UInt32\n) AS\nSELECT *\nFROM test_1602.tbl
|
||||
CREATE VIEW test_1602.DICTIONARY\n(\n `EventDate` DateTime,\n `CounterID` UInt32,\n `UserID` UInt32\n) AS\nSELECT *\nFROM test_1602.tbl
|
||||
CREATE VIEW test_1602.TABLE\n(\n `EventDate` DateTime,\n `CounterID` UInt32,\n `UserID` UInt32\n) AS\nSELECT *\nFROM test_1602.tbl
|
@ -1,53 +0,0 @@
|
||||
-- Tags: no-parallel
|
||||
|
||||
DROP DATABASE IF EXISTS test_1602;
|
||||
|
||||
CREATE DATABASE test_1602;
|
||||
|
||||
CREATE TABLE test_1602.tbl (`EventDate` DateTime, `CounterID` UInt32, `UserID` UInt32) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SETTINGS index_granularity = 8192;
|
||||
|
||||
CREATE VIEW test_1602.v AS SELECT * FROM test_1602.tbl;
|
||||
|
||||
CREATE VIEW test_1602.DATABASE AS SELECT * FROM test_1602.tbl;
|
||||
|
||||
CREATE VIEW test_1602.DICTIONARY AS SELECT * FROM test_1602.tbl;
|
||||
|
||||
CREATE VIEW test_1602.TABLE AS SELECT * FROM test_1602.tbl;
|
||||
|
||||
CREATE MATERIALIZED VIEW test_1602.vv (`EventDate` DateTime, `CounterID` UInt32, `UserID` UInt32) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SETTINGS index_granularity = 8192 AS SELECT * FROM test_1602.tbl;
|
||||
|
||||
CREATE VIEW test_1602.VIEW AS SELECT * FROM test_1602.tbl;
|
||||
|
||||
SET allow_experimental_live_view=1;
|
||||
|
||||
CREATE LIVE VIEW test_1602.vvv AS SELECT * FROM test_1602.tbl;
|
||||
|
||||
SHOW CREATE VIEW test_1602.v;
|
||||
|
||||
SHOW CREATE VIEW test_1602.vv;
|
||||
|
||||
SHOW CREATE VIEW test_1602.vvv;
|
||||
|
||||
SHOW CREATE VIEW test_1602.not_exist_view; -- { serverError 390 }
|
||||
|
||||
SHOW CREATE VIEW test_1602.tbl; -- { serverError 36 }
|
||||
|
||||
SHOW CREATE TEMPORARY VIEW; -- { serverError 60 }
|
||||
|
||||
SHOW CREATE VIEW; -- { clientError 62 }
|
||||
|
||||
SHOW CREATE DATABASE; -- { clientError 62 }
|
||||
|
||||
SHOW CREATE DICTIONARY; -- { clientError 62 }
|
||||
|
||||
SHOW CREATE TABLE; -- { clientError 62 }
|
||||
|
||||
SHOW CREATE test_1602.VIEW;
|
||||
|
||||
SHOW CREATE test_1602.DATABASE;
|
||||
|
||||
SHOW CREATE test_1602.DICTIONARY;
|
||||
|
||||
SHOW CREATE test_1602.TABLE;
|
||||
|
||||
DROP DATABASE IF EXISTS test_1602;
|
@ -1,94 +0,0 @@
|
||||
Row 1:
|
||||
──────
|
||||
stage: Query log rows
|
||||
read_rows: 400
|
||||
written_rows: 201
|
||||
databases: ['_table_function','default']
|
||||
tables: ['_table_function.numbers','default.table_a','default.table_b','default.table_b_live_view','default.table_c']
|
||||
views: ['default.matview_a_to_b','default.matview_b_to_c','default.table_b_live_view']
|
||||
sleep_calls: 200
|
||||
sleep_us: 298
|
||||
profile_select_rows: 400
|
||||
profile_select_bytes: 5200
|
||||
profile_insert_rows: 201
|
||||
profile_insert_bytes: 2808
|
||||
Row 1:
|
||||
──────
|
||||
stage: Depending views
|
||||
view_name: default.matview_a_to_b
|
||||
view_type: Materialized
|
||||
status: QueryFinish
|
||||
view_target: default.table_b
|
||||
view_query: SELECT toFloat64(a) AS a, b + sleepEachRow(0.000001) AS count FROM default.table_a
|
||||
read_rows: 100
|
||||
written_rows: 100
|
||||
sleep_calls: 100
|
||||
sleep_us: 99
|
||||
profile_select_rows: 100
|
||||
profile_select_bytes: 2000
|
||||
profile_insert_rows: 100
|
||||
profile_insert_bytes: 800
|
||||
|
||||
Row 2:
|
||||
──────
|
||||
stage: Depending views
|
||||
view_name: default.matview_b_to_c
|
||||
view_type: Materialized
|
||||
status: QueryFinish
|
||||
view_target: default.table_c
|
||||
view_query: SELECT sum(a + sleepEachRow(0.000002)) AS a FROM default.table_b
|
||||
read_rows: 100
|
||||
written_rows: 1
|
||||
sleep_calls: 100
|
||||
sleep_us: 199
|
||||
profile_select_rows: 100
|
||||
profile_select_bytes: 800
|
||||
profile_insert_rows: 1
|
||||
profile_insert_bytes: 8
|
||||
|
||||
Row 3:
|
||||
──────
|
||||
stage: Depending views
|
||||
view_name: default.table_b_live_view
|
||||
view_type: Live
|
||||
status: QueryFinish
|
||||
view_target: default.table_b_live_view
|
||||
view_query: SELECT sum(a + b) FROM default.table_b
|
||||
read_rows: 100
|
||||
written_rows: 0
|
||||
sleep_calls: 0
|
||||
sleep_us: 0
|
||||
profile_select_rows: 100
|
||||
profile_select_bytes: 1600
|
||||
profile_insert_rows: 0
|
||||
profile_insert_bytes: 0
|
||||
Row 1:
|
||||
──────
|
||||
stage: Query log rows 2
|
||||
read_rows: 100
|
||||
written_rows: 100
|
||||
databases: ['_table_function','default']
|
||||
tables: ['_table_function.numbers','default.table_d','default.table_e','default.table_f']
|
||||
views: ['default.matview_join_d_e']
|
||||
sleep_calls: 50
|
||||
sleep_us: 150
|
||||
profile_select_rows: 100
|
||||
profile_select_bytes: 800
|
||||
profile_insert_rows: 100
|
||||
profile_insert_bytes: 1600
|
||||
Row 1:
|
||||
──────
|
||||
stage: Depending views 2
|
||||
view_name: default.matview_join_d_e
|
||||
view_type: Materialized
|
||||
status: QueryFinish
|
||||
view_target: default.table_f
|
||||
view_query: SELECT table_d.a AS a, table_e.count + sleepEachRow(0.000003) AS count FROM default.table_d LEFT JOIN default.table_e ON table_d.a = table_e.a
|
||||
read_rows: 50
|
||||
written_rows: 50
|
||||
sleep_calls: 50
|
||||
sleep_us: 150
|
||||
profile_select_rows: 50
|
||||
profile_select_bytes: 400
|
||||
profile_insert_rows: 50
|
||||
profile_insert_bytes: 800
|
@ -1,145 +0,0 @@
|
||||
SET allow_experimental_live_view = 1;
|
||||
SET log_queries=0;
|
||||
SET log_query_threads=0;
|
||||
|
||||
-- SETUP TABLES
|
||||
CREATE TABLE table_a (a String, b Int64) ENGINE = MergeTree ORDER BY b;
|
||||
CREATE TABLE table_b (a Float64, b Int64) ENGINE = MergeTree ORDER BY tuple();
|
||||
CREATE TABLE table_c (a Float64) ENGINE = MergeTree ORDER BY a;
|
||||
|
||||
CREATE TABLE table_d (a Float64, count Int64) ENGINE MergeTree ORDER BY a;
|
||||
CREATE TABLE table_e (a Float64, count Int64) ENGINE MergeTree ORDER BY a;
|
||||
CREATE TABLE table_f (a Float64, count Int64) ENGINE MergeTree ORDER BY a;
|
||||
|
||||
-- SETUP MATERIALIZED VIEWS
|
||||
CREATE MATERIALIZED VIEW matview_a_to_b TO table_b AS SELECT toFloat64(a) AS a, b + sleepEachRow(0.000001) AS count FROM table_a;
|
||||
CREATE MATERIALIZED VIEW matview_b_to_c TO table_c AS SELECT SUM(a + sleepEachRow(0.000002)) as a FROM table_b;
|
||||
CREATE MATERIALIZED VIEW matview_join_d_e TO table_f AS SELECT table_d.a as a, table_e.count + sleepEachRow(0.000003) as count FROM table_d LEFT JOIN table_e ON table_d.a = table_e.a;
|
||||
|
||||
-- SETUP LIVE VIEW
|
||||
---- table_b_live_view (Int64)
|
||||
DROP TABLE IF EXISTS table_b_live_view;
|
||||
CREATE LIVE VIEW table_b_live_view AS SELECT sum(a + b) FROM table_b;
|
||||
|
||||
-- ENABLE LOGS
|
||||
SET log_query_views=1;
|
||||
SET log_queries_min_type='QUERY_FINISH';
|
||||
SET log_queries=1;
|
||||
|
||||
-- INSERT 1
|
||||
INSERT INTO table_a SELECT '111', * FROM numbers(100);
|
||||
|
||||
-- INSERT 2
|
||||
INSERT INTO table_d SELECT 0.5, * FROM numbers(50);
|
||||
|
||||
SYSTEM FLUSH LOGS;
|
||||
|
||||
|
||||
-- CHECK LOGS OF INSERT 1
|
||||
-- Note that live views currently don't report written rows
|
||||
SELECT
|
||||
'Query log rows' as stage,
|
||||
read_rows,
|
||||
written_rows,
|
||||
arraySort(databases) as databases,
|
||||
arraySort(tables) as tables,
|
||||
arraySort(views) as views,
|
||||
ProfileEvents['SleepFunctionCalls'] as sleep_calls,
|
||||
ProfileEvents['SleepFunctionMicroseconds'] as sleep_us,
|
||||
ProfileEvents['SelectedRows'] as profile_select_rows,
|
||||
ProfileEvents['SelectedBytes'] as profile_select_bytes,
|
||||
ProfileEvents['InsertedRows'] as profile_insert_rows,
|
||||
ProfileEvents['InsertedBytes'] as profile_insert_bytes
|
||||
FROM system.query_log
|
||||
WHERE query like '-- INSERT 1%INSERT INTO table_a%'
|
||||
AND current_database = currentDatabase()
|
||||
AND event_date >= yesterday()
|
||||
FORMAT Vertical;
|
||||
|
||||
SELECT
|
||||
'Depending views' as stage,
|
||||
view_name,
|
||||
view_type,
|
||||
status,
|
||||
view_target,
|
||||
view_query,
|
||||
read_rows,
|
||||
written_rows,
|
||||
ProfileEvents['SleepFunctionCalls'] as sleep_calls,
|
||||
ProfileEvents['SleepFunctionMicroseconds'] as sleep_us,
|
||||
ProfileEvents['SelectedRows'] as profile_select_rows,
|
||||
ProfileEvents['SelectedBytes'] as profile_select_bytes,
|
||||
ProfileEvents['InsertedRows'] as profile_insert_rows,
|
||||
ProfileEvents['InsertedBytes'] as profile_insert_bytes
|
||||
FROM system.query_views_log
|
||||
WHERE initial_query_id =
|
||||
(
|
||||
SELECT initial_query_id
|
||||
FROM system.query_log
|
||||
WHERE query like '-- INSERT 1%INSERT INTO table_a%'
|
||||
AND current_database = currentDatabase()
|
||||
AND event_date >= yesterday()
|
||||
LIMIT 1
|
||||
)
|
||||
ORDER BY view_name
|
||||
FORMAT Vertical;
|
||||
|
||||
-- CHECK LOGS OF INSERT 2
|
||||
SELECT
|
||||
'Query log rows 2' as stage,
|
||||
read_rows,
|
||||
written_rows,
|
||||
arraySort(databases) as databases,
|
||||
arraySort(tables) as tables,
|
||||
arraySort(views) as views,
|
||||
ProfileEvents['SleepFunctionCalls'] as sleep_calls,
|
||||
ProfileEvents['SleepFunctionMicroseconds'] as sleep_us,
|
||||
ProfileEvents['SelectedRows'] as profile_select_rows,
|
||||
ProfileEvents['SelectedBytes'] as profile_select_bytes,
|
||||
ProfileEvents['InsertedRows'] as profile_insert_rows,
|
||||
ProfileEvents['InsertedBytes'] as profile_insert_bytes
|
||||
FROM system.query_log
|
||||
WHERE query like '-- INSERT 2%INSERT INTO table_d%'
|
||||
AND current_database = currentDatabase()
|
||||
AND event_date >= yesterday()
|
||||
FORMAT Vertical;
|
||||
|
||||
SELECT
|
||||
'Depending views 2' as stage,
|
||||
view_name,
|
||||
view_type,
|
||||
status,
|
||||
view_target,
|
||||
view_query,
|
||||
read_rows,
|
||||
written_rows,
|
||||
ProfileEvents['SleepFunctionCalls'] as sleep_calls,
|
||||
ProfileEvents['SleepFunctionMicroseconds'] as sleep_us,
|
||||
ProfileEvents['SelectedRows'] as profile_select_rows,
|
||||
ProfileEvents['SelectedBytes'] as profile_select_bytes,
|
||||
ProfileEvents['InsertedRows'] as profile_insert_rows,
|
||||
ProfileEvents['InsertedBytes'] as profile_insert_bytes
|
||||
FROM system.query_views_log
|
||||
WHERE initial_query_id =
|
||||
(
|
||||
SELECT initial_query_id
|
||||
FROM system.query_log
|
||||
WHERE query like '-- INSERT 2%INSERT INTO table_d%'
|
||||
AND current_database = currentDatabase()
|
||||
AND event_date >= yesterday()
|
||||
LIMIT 1
|
||||
)
|
||||
ORDER BY view_name
|
||||
FORMAT Vertical;
|
||||
|
||||
-- TEARDOWN
|
||||
DROP TABLE table_b_live_view;
|
||||
DROP TABLE matview_a_to_b;
|
||||
DROP TABLE matview_b_to_c;
|
||||
DROP TABLE matview_join_d_e;
|
||||
DROP TABLE table_f;
|
||||
DROP TABLE table_e;
|
||||
DROP TABLE table_d;
|
||||
DROP TABLE table_c;
|
||||
DROP TABLE table_b;
|
||||
DROP TABLE table_a;
|
@ -1,3 +0,0 @@
|
||||
live_view_comment_test LiveView live view
|
||||
materialized_view_comment_test MaterializedView materialized view
|
||||
view_comment_test View simple view
|
@ -1,12 +0,0 @@
|
||||
-- Make sure that any kind of `VIEW` can be created with a `COMMENT` clause
|
||||
-- and value of that clause is visible as `comment` column of `system.tables` table.
|
||||
|
||||
CREATE VIEW view_comment_test AS (SELECT 1) COMMENT 'simple view';
|
||||
CREATE MATERIALIZED VIEW materialized_view_comment_test TO test1 (a UInt64) AS (SELECT 1) COMMENT 'materialized view';
|
||||
|
||||
SET allow_experimental_live_view=1;
|
||||
CREATE LIVE VIEW live_view_comment_test AS (SELECT 1) COMMENT 'live view';
|
||||
|
||||
SYSTEM FLUSH LOGS;
|
||||
|
||||
SELECT name, engine, comment FROM system.tables WHERE database == currentDatabase() ORDER BY name;
|
Loading…
Reference in New Issue
Block a user