mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Disabled implicit moving to PREWHERE when using FINAL [#METR-20644].
This commit is contained in:
parent
3e60a95cdd
commit
47898ae73b
@ -130,9 +130,8 @@ BlockInputStreams StorageMergeTree::read(
|
||||
auto & select = typeid_cast<const ASTSelectQuery &>(*query);
|
||||
|
||||
/// Try transferring some condition from WHERE to PREWHERE if enabled and viable
|
||||
if (settings.optimize_move_to_prewhere)
|
||||
if (select.where_expression && !select.prewhere_expression)
|
||||
MergeTreeWhereOptimizer{query, context, data, column_names, log};
|
||||
if (settings.optimize_move_to_prewhere && select.where_expression && !select.prewhere_expression && !select.final)
|
||||
MergeTreeWhereOptimizer{query, context, data, column_names, log};
|
||||
|
||||
return reader.read(column_names, query, context, settings, processed_stage, max_block_size, threads, nullptr, 0);
|
||||
}
|
||||
|
@ -2089,9 +2089,8 @@ BlockInputStreams StorageReplicatedMergeTree::read(
|
||||
auto & select = typeid_cast<const ASTSelectQuery &>(*query);
|
||||
|
||||
/// Try transferring some condition from WHERE to PREWHERE if enabled and viable
|
||||
if (settings.optimize_move_to_prewhere)
|
||||
if (select.where_expression && !select.prewhere_expression)
|
||||
MergeTreeWhereOptimizer{query, context, data, real_column_names, log};
|
||||
if (settings.optimize_move_to_prewhere && select.where_expression && !select.prewhere_expression && !select.final)
|
||||
MergeTreeWhereOptimizer{query, context, data, real_column_names, log};
|
||||
|
||||
Block virtual_columns_block;
|
||||
auto column = std::make_shared<ColumnUInt8>(2);
|
||||
|
@ -0,0 +1,11 @@
|
||||
1
|
||||
0
|
||||
1
|
||||
4
|
||||
9
|
||||
16
|
||||
25
|
||||
36
|
||||
49
|
||||
64
|
||||
81
|
11
dbms/tests/queries/0_stateless/00330_view_subqueries.sql
Normal file
11
dbms/tests/queries/0_stateless/00330_view_subqueries.sql
Normal file
@ -0,0 +1,11 @@
|
||||
DROP TABLE IF EXISTS test.v1;
|
||||
DROP TABLE IF EXISTS test.v2;
|
||||
|
||||
CREATE VIEW test.v1 AS SELECT 1 FROM (SELECT 1);
|
||||
SELECT * FROM test.v1;
|
||||
|
||||
CREATE VIEW test.v2 AS SELECT number * number FROM (SELECT number FROM system.numbers LIMIT 10);
|
||||
SELECT * FROM test.v2;
|
||||
|
||||
DROP TABLE test.v1;
|
||||
DROP TABLE test.v2;
|
@ -0,0 +1,5 @@
|
||||
2016-06-02 1 version 0 0
|
||||
2016-06-02 1 version 1 1
|
||||
2016-06-02 2 version 1 1
|
||||
2016-06-02 1 version 1 1
|
||||
2016-06-02 2 version 1 1
|
12
dbms/tests/queries/0_stateless/00331_final_and_prewhere.sql
Normal file
12
dbms/tests/queries/0_stateless/00331_final_and_prewhere.sql
Normal file
@ -0,0 +1,12 @@
|
||||
DROP TABLE IF EXISTS test.replace;
|
||||
|
||||
CREATE TABLE test.replace ( EventDate Date, Id UInt64, Data String, Version UInt32) ENGINE = ReplacingMergeTree(EventDate, Id, 8192, Version);
|
||||
INSERT INTO test.replace VALUES ('2016-06-02', 1, 'version 1', 1);
|
||||
INSERT INTO test.replace VALUES ('2016-06-02', 2, 'version 1', 1);
|
||||
INSERT INTO test.replace VALUES ('2016-06-02', 1, 'version 0', 0);
|
||||
|
||||
SELECT * FROM test.replace ORDER BY Id, Version;
|
||||
SELECT * FROM test.replace FINAL ORDER BY Id, Version;
|
||||
SELECT * FROM test.replace FINAL WHERE Version = 0 ORDER BY Id, Version;
|
||||
|
||||
DROP TABLE test.replace;
|
Loading…
Reference in New Issue
Block a user