mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 11:02:08 +00:00
Merge pull request #41164 from ClickHouse/revert-41015-window_func_optimization_setting
Revert "Query plan optimization setting: read in window order"
This commit is contained in:
commit
1a47426b6e
@ -58,8 +58,6 @@ public:
|
|||||||
/// Add limits from external query.
|
/// Add limits from external query.
|
||||||
void addStorageLimits(const StorageLimitsList & limits);
|
void addStorageLimits(const StorageLimitsList & limits);
|
||||||
|
|
||||||
ContextPtr getContext() const { return context; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ASTPtr query_ptr;
|
ASTPtr query_ptr;
|
||||||
ContextMutablePtr context;
|
ContextMutablePtr context;
|
||||||
|
@ -316,7 +316,7 @@ QueryPipeline InterpreterExplainQuery::executeImpl()
|
|||||||
interpreter.buildQueryPlan(plan);
|
interpreter.buildQueryPlan(plan);
|
||||||
|
|
||||||
if (settings.optimize)
|
if (settings.optimize)
|
||||||
plan.optimize(QueryPlanOptimizationSettings::fromContext(interpreter.getContext()));
|
plan.optimize(QueryPlanOptimizationSettings::fromContext(getContext()));
|
||||||
|
|
||||||
if (settings.json)
|
if (settings.json)
|
||||||
{
|
{
|
||||||
@ -326,7 +326,7 @@ QueryPipeline InterpreterExplainQuery::executeImpl()
|
|||||||
auto plan_array = std::make_unique<JSONBuilder::JSONArray>();
|
auto plan_array = std::make_unique<JSONBuilder::JSONArray>();
|
||||||
plan_array->add(std::move(plan_map));
|
plan_array->add(std::move(plan_map));
|
||||||
|
|
||||||
auto format_settings = getFormatSettings(interpreter.getContext());
|
auto format_settings = getFormatSettings(getContext());
|
||||||
format_settings.json.quote_64bit_integers = false;
|
format_settings.json.quote_64bit_integers = false;
|
||||||
|
|
||||||
JSONBuilder::FormatSettings json_format_settings{.settings = format_settings};
|
JSONBuilder::FormatSettings json_format_settings{.settings = format_settings};
|
||||||
|
@ -63,7 +63,7 @@ inline const auto & getOptimizations()
|
|||||||
{tryMergeExpressions, "mergeExpressions", &QueryPlanOptimizationSettings::optimize_plan},
|
{tryMergeExpressions, "mergeExpressions", &QueryPlanOptimizationSettings::optimize_plan},
|
||||||
{tryPushDownFilter, "pushDownFilter", &QueryPlanOptimizationSettings::filter_push_down},
|
{tryPushDownFilter, "pushDownFilter", &QueryPlanOptimizationSettings::filter_push_down},
|
||||||
{tryExecuteFunctionsAfterSorting, "liftUpFunctions", &QueryPlanOptimizationSettings::optimize_plan},
|
{tryExecuteFunctionsAfterSorting, "liftUpFunctions", &QueryPlanOptimizationSettings::optimize_plan},
|
||||||
{tryReuseStorageOrderingForWindowFunctions, "reuseStorageOrderingForWindowFunctions", &QueryPlanOptimizationSettings::optimize_read_in_window_order}
|
{tryReuseStorageOrderingForWindowFunctions, "reuseStorageOrderingForWindowFunctions", &QueryPlanOptimizationSettings::optimize_plan}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
return optimizations;
|
return optimizations;
|
||||||
|
@ -11,7 +11,6 @@ QueryPlanOptimizationSettings QueryPlanOptimizationSettings::fromSettings(const
|
|||||||
settings.optimize_plan = from.query_plan_enable_optimizations;
|
settings.optimize_plan = from.query_plan_enable_optimizations;
|
||||||
settings.max_optimizations_to_apply = from.query_plan_max_optimizations_to_apply;
|
settings.max_optimizations_to_apply = from.query_plan_max_optimizations_to_apply;
|
||||||
settings.filter_push_down = from.query_plan_filter_push_down;
|
settings.filter_push_down = from.query_plan_filter_push_down;
|
||||||
settings.optimize_read_in_window_order = from.optimize_read_in_window_order;
|
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,6 @@ struct QueryPlanOptimizationSettings
|
|||||||
/// If filter push down optimization is enabled.
|
/// If filter push down optimization is enabled.
|
||||||
bool filter_push_down = true;
|
bool filter_push_down = true;
|
||||||
|
|
||||||
/// window functions read in order optimization
|
|
||||||
bool optimize_read_in_window_order = true;
|
|
||||||
|
|
||||||
static QueryPlanOptimizationSettings fromSettings(const Settings & from);
|
static QueryPlanOptimizationSettings fromSettings(const Settings & from);
|
||||||
static QueryPlanOptimizationSettings fromContext(ContextPtr from);
|
static QueryPlanOptimizationSettings fromContext(ContextPtr from);
|
||||||
};
|
};
|
||||||
|
@ -61,7 +61,12 @@ size_t tryReuseStorageOrderingForWindowFunctions(QueryPlan::Node * parent_node,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto context = read_from_merge_tree->getContext();
|
auto context = read_from_merge_tree->getContext();
|
||||||
|
if (!context->getSettings().optimize_read_in_window_order)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const auto & query_info = read_from_merge_tree->getQueryInfo();
|
const auto & query_info = read_from_merge_tree->getQueryInfo();
|
||||||
const auto * select_query = query_info.query->as<ASTSelectQuery>();
|
const auto * select_query = query_info.query->as<ASTSelectQuery>();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user