mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +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.
|
||||
void addStorageLimits(const StorageLimitsList & limits);
|
||||
|
||||
ContextPtr getContext() const { return context; }
|
||||
|
||||
protected:
|
||||
ASTPtr query_ptr;
|
||||
ContextMutablePtr context;
|
||||
|
@ -316,7 +316,7 @@ QueryPipeline InterpreterExplainQuery::executeImpl()
|
||||
interpreter.buildQueryPlan(plan);
|
||||
|
||||
if (settings.optimize)
|
||||
plan.optimize(QueryPlanOptimizationSettings::fromContext(interpreter.getContext()));
|
||||
plan.optimize(QueryPlanOptimizationSettings::fromContext(getContext()));
|
||||
|
||||
if (settings.json)
|
||||
{
|
||||
@ -326,7 +326,7 @@ QueryPipeline InterpreterExplainQuery::executeImpl()
|
||||
auto plan_array = std::make_unique<JSONBuilder::JSONArray>();
|
||||
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;
|
||||
|
||||
JSONBuilder::FormatSettings json_format_settings{.settings = format_settings};
|
||||
|
@ -63,7 +63,7 @@ inline const auto & getOptimizations()
|
||||
{tryMergeExpressions, "mergeExpressions", &QueryPlanOptimizationSettings::optimize_plan},
|
||||
{tryPushDownFilter, "pushDownFilter", &QueryPlanOptimizationSettings::filter_push_down},
|
||||
{tryExecuteFunctionsAfterSorting, "liftUpFunctions", &QueryPlanOptimizationSettings::optimize_plan},
|
||||
{tryReuseStorageOrderingForWindowFunctions, "reuseStorageOrderingForWindowFunctions", &QueryPlanOptimizationSettings::optimize_read_in_window_order}
|
||||
{tryReuseStorageOrderingForWindowFunctions, "reuseStorageOrderingForWindowFunctions", &QueryPlanOptimizationSettings::optimize_plan}
|
||||
}};
|
||||
|
||||
return optimizations;
|
||||
|
@ -11,7 +11,6 @@ QueryPlanOptimizationSettings QueryPlanOptimizationSettings::fromSettings(const
|
||||
settings.optimize_plan = from.query_plan_enable_optimizations;
|
||||
settings.max_optimizations_to_apply = from.query_plan_max_optimizations_to_apply;
|
||||
settings.filter_push_down = from.query_plan_filter_push_down;
|
||||
settings.optimize_read_in_window_order = from.optimize_read_in_window_order;
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,6 @@ struct QueryPlanOptimizationSettings
|
||||
/// If filter push down optimization is enabled.
|
||||
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 fromContext(ContextPtr from);
|
||||
};
|
||||
|
@ -61,7 +61,12 @@ size_t tryReuseStorageOrderingForWindowFunctions(QueryPlan::Node * parent_node,
|
||||
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 * select_query = query_info.query->as<ASTSelectQuery>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user