mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 18:42:26 +00:00
fix wrong check for disabling "read in order" optimization
This commit is contained in:
parent
a1560448d6
commit
d573c4ec3e
@ -884,7 +884,7 @@ void InterpreterSelectQuery::executeImpl(TPipeline & pipeline, const BlockInputS
|
|||||||
}
|
}
|
||||||
|
|
||||||
SortingInfoPtr sorting_info;
|
SortingInfoPtr sorting_info;
|
||||||
if (settings.optimize_read_in_order && storage && query.orderBy() && !query.groupBy() && !query.final() && !query.join())
|
if (settings.optimize_read_in_order && storage && query.orderBy() && !query_analyzer->hasAggregation() && !query.final() && !query.join())
|
||||||
{
|
{
|
||||||
if (const MergeTreeData * merge_tree_data = dynamic_cast<const MergeTreeData *>(storage.get()))
|
if (const MergeTreeData * merge_tree_data = dynamic_cast<const MergeTreeData *>(storage.get()))
|
||||||
sorting_info = optimizeReadInOrder(*merge_tree_data, query, context, syntax_analyzer_result);
|
sorting_info = optimizeReadInOrder(*merge_tree_data, query, context, syntax_analyzer_result);
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
4950
|
@ -0,0 +1,6 @@
|
|||||||
|
SET optimize_read_in_order = 1;
|
||||||
|
DROP TABLE IF EXISTS order_with_aggr;
|
||||||
|
CREATE TABLE order_with_aggr(a Int) ENGINE = MergeTree ORDER BY a;
|
||||||
|
|
||||||
|
INSERT INTO order_with_aggr SELECT * FROM numbers(100);
|
||||||
|
SELECT sum(a) as s FROM order_with_aggr ORDER BY s;
|
Loading…
Reference in New Issue
Block a user