mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Allpy some more optimizations to NO_QUERY ast.
This commit is contained in:
parent
64263a043a
commit
d394f0e753
@ -1117,7 +1117,7 @@ TreeRewriterResultPtr TreeRewriter::analyzeSelect(
|
||||
result.rewrite_subqueries = PredicateExpressionsOptimizer(getContext(), tables_with_columns, settings).optimize(*select_query);
|
||||
|
||||
/// Only apply AST optimization for initial queries.
|
||||
if (getContext()->getClientInfo().query_kind == ClientInfo::QueryKind::INITIAL_QUERY)
|
||||
if (getContext()->getClientInfo().query_kind != ClientInfo::QueryKind::SECONDARY_QUERY)
|
||||
TreeOptimizer::apply(query, result, tables_with_columns, getContext());
|
||||
|
||||
/// array_join_alias_to_name, array_join_result_to_source.
|
||||
|
@ -284,6 +284,12 @@ def test_rabbitmq_materialized_view(rabbitmq_cluster):
|
||||
ORDER BY key;
|
||||
CREATE MATERIALIZED VIEW test.consumer TO test.view AS
|
||||
SELECT * FROM test.rabbitmq;
|
||||
|
||||
CREATE TABLE test.view2 (key UInt64, value UInt64)
|
||||
ENGINE = MergeTree()
|
||||
ORDER BY key;
|
||||
CREATE MATERIALIZED VIEW test.consumer2 TO test.view2 AS
|
||||
SELECT * FROM test.rabbitmq group by (key, value);
|
||||
''')
|
||||
|
||||
credentials = pika.PlainCredentials('root', 'clickhouse')
|
||||
@ -297,14 +303,26 @@ def test_rabbitmq_materialized_view(rabbitmq_cluster):
|
||||
for message in messages:
|
||||
channel.basic_publish(exchange='mv', routing_key='', body=message)
|
||||
|
||||
while True:
|
||||
time_limit_sec = 60
|
||||
deadline = time.monotonic() + time_limit_sec
|
||||
|
||||
while time.monotonic() < deadline:
|
||||
result = instance.query('SELECT * FROM test.view ORDER BY key')
|
||||
if (rabbitmq_check_result(result)):
|
||||
break
|
||||
|
||||
connection.close()
|
||||
rabbitmq_check_result(result, True)
|
||||
|
||||
deadline = time.monotonic() + time_limit_sec
|
||||
|
||||
while time.monotonic() < deadline:
|
||||
result = instance.query('SELECT * FROM test.view2 ORDER BY key')
|
||||
if (rabbitmq_check_result(result)):
|
||||
break
|
||||
|
||||
rabbitmq_check_result(result, True)
|
||||
connection.close()
|
||||
|
||||
|
||||
def test_rabbitmq_materialized_view_with_subquery(rabbitmq_cluster):
|
||||
instance.query('''
|
||||
|
Loading…
Reference in New Issue
Block a user