mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
revert Planner.cpp
This commit is contained in:
parent
99095446af
commit
f64c5fb3fa
@ -720,7 +720,7 @@ bool addPreliminaryLimitOptimizationStepIfNeeded(QueryPlan & query_plan,
|
||||
|
||||
bool apply_limit = query_processing_info.getToStage() != QueryProcessingStage::WithMergeableStateAfterAggregation;
|
||||
bool apply_prelimit = apply_limit &&
|
||||
query_analysis_result.limit_length &&
|
||||
query_node.hasLimit() &&
|
||||
!query_node.isLimitWithTies() &&
|
||||
!query_node.isGroupByWithTotals() &&
|
||||
!query_analysis_result.query_has_with_totals_in_any_subquery_in_join_tree &&
|
||||
@ -767,7 +767,7 @@ void addPreliminarySortOrDistinctOrLimitStepsIfNeeded(QueryPlan & query_plan,
|
||||
* Otherwise we can take several equal values from different streams
|
||||
* according to limit and skip some distinct values.
|
||||
*/
|
||||
if (query_analysis_result.limit_length && query_node.isDistinct())
|
||||
if (query_node.hasLimit() && query_node.isDistinct())
|
||||
{
|
||||
addDistinctStep(query_plan,
|
||||
query_analysis_result,
|
||||
@ -785,7 +785,7 @@ void addPreliminarySortOrDistinctOrLimitStepsIfNeeded(QueryPlan & query_plan,
|
||||
addLimitByStep(query_plan, limit_by_analysis_result, query_node);
|
||||
}
|
||||
|
||||
if (query_analysis_result.limit_length)
|
||||
if (query_node.hasLimit())
|
||||
addPreliminaryLimitStep(query_plan, query_analysis_result, planner_context, true /*do_not_skip_offset*/);
|
||||
}
|
||||
|
||||
@ -1420,7 +1420,7 @@ void Planner::buildPlanForQueryNode()
|
||||
|
||||
bool apply_offset = query_processing_info.getToStage() != QueryProcessingStage::WithMergeableStateAfterAggregationAndLimit;
|
||||
|
||||
if (query_analysis_result.limit_length && query_node.isLimitWithTies() && apply_offset)
|
||||
if (query_node.hasLimit() && query_node.isLimitWithTies() && apply_offset)
|
||||
addLimitStep(query_plan, query_analysis_result, planner_context, query_node);
|
||||
|
||||
addExtremesStepIfNeeded(query_plan, planner_context);
|
||||
@ -1434,9 +1434,9 @@ void Planner::buildPlanForQueryNode()
|
||||
* This is the case for various optimizations for distributed queries,
|
||||
* and when LIMIT cannot be applied it will be applied on the initiator anyway.
|
||||
*/
|
||||
if (query_analysis_result.limit_length && apply_limit && !limit_applied && apply_offset)
|
||||
if (query_node.hasLimit() && apply_limit && !limit_applied && apply_offset)
|
||||
addLimitStep(query_plan, query_analysis_result, planner_context, query_node);
|
||||
else if (!limit_applied && apply_offset && query_analysis_result.limit_offset)
|
||||
else if (!limit_applied && apply_offset && query_node.hasOffset())
|
||||
addOffsetStep(query_plan, query_analysis_result);
|
||||
|
||||
/// Project names is not done on shards, because initiator will not find columns in blocks
|
||||
|
Loading…
Reference in New Issue
Block a user