mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Merge branch 'fix_ISSUE5695' of https://github.com/TCeason/ClickHouse into TCeason-fix_ISSUE5695
This commit is contained in:
commit
93c7f6aedf
@ -307,6 +307,7 @@ struct Settings : public SettingsCollection<Settings>
|
||||
M(SettingBool, log_query_threads, true, "Log query threads into system.query_thread_log table. This setting have effect only when 'log_queries' is true.") \
|
||||
M(SettingLogsLevel, send_logs_level, LogsLevel::none, "Send server text logs with specified minimum level to client. Valid values: 'trace', 'debug', 'information', 'warning', 'error', 'none'") \
|
||||
M(SettingBool, enable_optimize_predicate_expression, 1, "If it is set to true, optimize predicates to subqueries.") \
|
||||
M(SettingBool, enable_optimize_predicate_expression_to_final_subquery, 1, "Allow push predicate to final subquery.")
|
||||
\
|
||||
M(SettingUInt64, low_cardinality_max_dictionary_size, 8192, "Maximum size (in rows) of shared global dictionary for LowCardinality type.") \
|
||||
M(SettingBool, low_cardinality_use_single_dictionary_for_part, false, "LowCardinality type serialization setting. If is true, than will use additional keys when global dictionary overflows. Otherwise, will create several shared dictionaries.") \
|
||||
@ -338,7 +339,7 @@ struct Settings : public SettingsCollection<Settings>
|
||||
\
|
||||
/** Obsolete settings that do nothing but left for compatibility reasons. Remove each one after half a year of obsolescence. */ \
|
||||
\
|
||||
M(SettingBool, allow_experimental_low_cardinality_type, true, "Obsolete setting, does nothing. Will be removed after 2019-08-13")
|
||||
M(SettingBool, allow_experimental_low_cardinality_type, true, "Obsolete setting, does nothing. Will be removed after 2019-08-13") \
|
||||
|
||||
DECLARE_SETTINGS_COLLECTION(LIST_OF_SETTINGS)
|
||||
|
||||
|
@ -138,7 +138,10 @@ bool PredicateExpressionsOptimizer::allowPushDown(
|
||||
const std::vector<IdentifierWithQualifier> & dependencies,
|
||||
OptimizeKind & optimize_kind)
|
||||
{
|
||||
if (!subquery || subquery->final() || subquery->limitBy() || subquery->limitLength() || subquery->with())
|
||||
if (!subquery
|
||||
|| (!settings.enable_optimize_predicate_expression_to_final_subquery && subquery->final())
|
||||
|| subquery->limitBy() || subquery->limitLength()
|
||||
|| subquery->with())
|
||||
return false;
|
||||
else
|
||||
{
|
||||
|
@ -39,6 +39,7 @@ class PredicateExpressionsOptimizer
|
||||
|
||||
/// for PredicateExpressionsOptimizer
|
||||
const bool enable_optimize_predicate_expression;
|
||||
const bool enable_optimize_predicate_expression_to_final_subquery;
|
||||
const bool join_use_nulls;
|
||||
|
||||
template<typename T>
|
||||
@ -47,6 +48,7 @@ class PredicateExpressionsOptimizer
|
||||
max_expanded_ast_elements(settings.max_expanded_ast_elements),
|
||||
count_distinct_implementation(settings.count_distinct_implementation),
|
||||
enable_optimize_predicate_expression(settings.enable_optimize_predicate_expression),
|
||||
enable_optimize_predicate_expression_to_final_subquery(settings.enable_optimize_predicate_expression_to_final_subquery),
|
||||
join_use_nulls(settings.join_use_nulls)
|
||||
{}
|
||||
};
|
||||
|
@ -0,0 +1,2 @@
|
||||
1
|
||||
1
|
@ -0,0 +1,17 @@
|
||||
DROP TABLE IF EXISTS test_00974;
|
||||
|
||||
CREATE TABLE test_00974
|
||||
(
|
||||
date Date,
|
||||
x Int32,
|
||||
ver UInt64
|
||||
)
|
||||
ENGINE = ReplacingMergeTree(date, x, 1);
|
||||
|
||||
INSERT INTO test_00974 VALUES ('2019-07-23', 1, 1), ('2019-07-23', 1, 2);
|
||||
INSERT INTO test_00974 VALUES ('2019-07-23', 2, 1), ('2019-07-23', 2, 2);
|
||||
|
||||
SELECT COUNT() FROM (SELECT * FROM test_00974 FINAL) where x = 1 SETTINGS allow_push_predicate_to_final_subquery = 0;
|
||||
SELECT COUNT() FROM (SELECT * FROM test_00974 FINAL) where x = 1 SETTINGS allow_push_predicate_to_final_subquery = 1, max_rows_to_read = 2;
|
||||
|
||||
DROP TABLE test_00974;
|
Loading…
Reference in New Issue
Block a user