mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
Revert "Limit number of analyze for one query"
This commit is contained in:
parent
5ae7f339c4
commit
5050e0aca5
@ -344,7 +344,7 @@ static constexpr UInt64 operator""_GiB(unsigned long long value)
|
|||||||
M(UInt64, max_temporary_non_const_columns, 0, "", 0) \
|
M(UInt64, max_temporary_non_const_columns, 0, "", 0) \
|
||||||
\
|
\
|
||||||
M(UInt64, max_subquery_depth, 100, "", 0) \
|
M(UInt64, max_subquery_depth, 100, "", 0) \
|
||||||
M(UInt64, max_pipeline_depth, 10000, "", 0) \
|
M(UInt64, max_pipeline_depth, 1000, "", 0) \
|
||||||
M(UInt64, max_ast_depth, 1000, "Maximum depth of query syntax tree. Checked after parsing.", 0) \
|
M(UInt64, max_ast_depth, 1000, "Maximum depth of query syntax tree. Checked after parsing.", 0) \
|
||||||
M(UInt64, max_ast_elements, 50000, "Maximum size of query syntax tree in number of nodes. Checked after parsing.", 0) \
|
M(UInt64, max_ast_elements, 50000, "Maximum size of query syntax tree in number of nodes. Checked after parsing.", 0) \
|
||||||
M(UInt64, max_expanded_ast_elements, 500000, "Maximum size of query syntax tree in number of nodes after expansion of aliases and the asterisk.", 0) \
|
M(UInt64, max_expanded_ast_elements, 500000, "Maximum size of query syntax tree in number of nodes after expansion of aliases and the asterisk.", 0) \
|
||||||
|
@ -367,27 +367,6 @@ public:
|
|||||||
// Top-level OpenTelemetry trace context for the query. Makes sense only for a query context.
|
// Top-level OpenTelemetry trace context for the query. Makes sense only for a query context.
|
||||||
OpenTelemetryTraceContext query_trace_context;
|
OpenTelemetryTraceContext query_trace_context;
|
||||||
|
|
||||||
/// Some counters for current query execution.
|
|
||||||
/// Most of them are workarounds and should be removed in the future.
|
|
||||||
struct KitchenSink
|
|
||||||
{
|
|
||||||
std::atomic<size_t> analyze_counter = 0;
|
|
||||||
|
|
||||||
KitchenSink() = default;
|
|
||||||
|
|
||||||
KitchenSink(const KitchenSink & rhs)
|
|
||||||
: analyze_counter(rhs.analyze_counter.load())
|
|
||||||
{}
|
|
||||||
|
|
||||||
KitchenSink & operator=(const KitchenSink & rhs)
|
|
||||||
{
|
|
||||||
analyze_counter = rhs.analyze_counter.load();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
KitchenSink kitchen_sink;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using SampleBlockCache = std::unordered_map<std::string, Block>;
|
using SampleBlockCache = std::unordered_map<std::string, Block>;
|
||||||
mutable SampleBlockCache sample_block_cache;
|
mutable SampleBlockCache sample_block_cache;
|
||||||
|
@ -98,7 +98,6 @@ namespace ErrorCodes
|
|||||||
extern const int SAMPLING_NOT_SUPPORTED;
|
extern const int SAMPLING_NOT_SUPPORTED;
|
||||||
extern const int ILLEGAL_FINAL;
|
extern const int ILLEGAL_FINAL;
|
||||||
extern const int ILLEGAL_PREWHERE;
|
extern const int ILLEGAL_PREWHERE;
|
||||||
extern const int TOO_DEEP_PIPELINE;
|
|
||||||
extern const int TOO_MANY_COLUMNS;
|
extern const int TOO_MANY_COLUMNS;
|
||||||
extern const int LOGICAL_ERROR;
|
extern const int LOGICAL_ERROR;
|
||||||
extern const int NOT_IMPLEMENTED;
|
extern const int NOT_IMPLEMENTED;
|
||||||
@ -499,14 +498,6 @@ InterpreterSelectQuery::InterpreterSelectQuery(
|
|||||||
|
|
||||||
auto analyze = [&] (bool try_move_to_prewhere)
|
auto analyze = [&] (bool try_move_to_prewhere)
|
||||||
{
|
{
|
||||||
if (context->hasQueryContext())
|
|
||||||
{
|
|
||||||
std::atomic<size_t> & current_query_analyze_count = context->getQueryContext()->kitchen_sink.analyze_counter;
|
|
||||||
++current_query_analyze_count;
|
|
||||||
if (settings.max_pipeline_depth && current_query_analyze_count >= settings.max_pipeline_depth)
|
|
||||||
throw DB::Exception(ErrorCodes::TOO_DEEP_PIPELINE, "Query analyze overflow. Try to increase `max_pipeline_depth` or simplify the query");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Allow push down and other optimizations for VIEW: replace with subquery and rewrite it.
|
/// Allow push down and other optimizations for VIEW: replace with subquery and rewrite it.
|
||||||
ASTPtr view_table;
|
ASTPtr view_table;
|
||||||
if (view)
|
if (view)
|
||||||
@ -645,7 +636,6 @@ InterpreterSelectQuery::InterpreterSelectQuery(
|
|||||||
analyze(shouldMoveToPrewhere());
|
analyze(shouldMoveToPrewhere());
|
||||||
|
|
||||||
bool need_analyze_again = false;
|
bool need_analyze_again = false;
|
||||||
|
|
||||||
if (analysis_result.prewhere_constant_filter_description.always_false || analysis_result.prewhere_constant_filter_description.always_true)
|
if (analysis_result.prewhere_constant_filter_description.always_false || analysis_result.prewhere_constant_filter_description.always_true)
|
||||||
{
|
{
|
||||||
if (analysis_result.prewhere_constant_filter_description.always_true)
|
if (analysis_result.prewhere_constant_filter_description.always_true)
|
||||||
@ -654,7 +644,6 @@ InterpreterSelectQuery::InterpreterSelectQuery(
|
|||||||
query.setExpression(ASTSelectQuery::Expression::PREWHERE, std::make_shared<ASTLiteral>(0u));
|
query.setExpression(ASTSelectQuery::Expression::PREWHERE, std::make_shared<ASTLiteral>(0u));
|
||||||
need_analyze_again = true;
|
need_analyze_again = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (analysis_result.where_constant_filter_description.always_false || analysis_result.where_constant_filter_description.always_true)
|
if (analysis_result.where_constant_filter_description.always_false || analysis_result.where_constant_filter_description.always_true)
|
||||||
{
|
{
|
||||||
if (analysis_result.where_constant_filter_description.always_true)
|
if (analysis_result.where_constant_filter_description.always_true)
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
-- Tags: long
|
|
||||||
|
|
||||||
-- https://github.com/ClickHouse/ClickHouse/issues/21557
|
|
||||||
|
|
||||||
SET max_pipeline_depth = 1000;
|
|
||||||
|
|
||||||
EXPLAIN SYNTAX
|
|
||||||
WITH
|
|
||||||
x AS ( SELECT number FROM numbers(10) ),
|
|
||||||
cross_sales AS (
|
|
||||||
SELECT 1 AS xx
|
|
||||||
FROM x, x AS d1, x AS d2, x AS d3, x AS d4, x AS d5, x AS d6, x AS d7, x AS d8, x AS d9
|
|
||||||
WHERE x.number = d9.number
|
|
||||||
)
|
|
||||||
SELECT xx FROM cross_sales WHERE xx = 2000; -- { serverError TOO_DEEP_PIPELINE }
|
|
Loading…
Reference in New Issue
Block a user