From a29d4f5db2aa6554ece3d1dbcef98928d899f6f4 Mon Sep 17 00:00:00 2001 From: liuneng <1398775315@qq.com> Date: Wed, 20 Mar 2024 10:24:34 +0800 Subject: [PATCH] fix bug --- src/Analyzer/Passes/ConvertInToEqualPass.cpp | 3 +-- src/Core/SettingsChangesHistory.h | 1 + tests/performance/function_in.xml | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Analyzer/Passes/ConvertInToEqualPass.cpp b/src/Analyzer/Passes/ConvertInToEqualPass.cpp index 26db3a4f4aa..e89300cd967 100644 --- a/src/Analyzer/Passes/ConvertInToEqualPass.cpp +++ b/src/Analyzer/Passes/ConvertInToEqualPass.cpp @@ -36,11 +36,10 @@ public: return ; if (constant_node->getValue().getType() == Field::Types::Which::Tuple) return; - auto const_value = std::make_shared(constant_node->getValue()); auto equal_resolver = createInternalFunctionEqualOverloadResolver(); auto equal = std::make_shared("equals"); - QueryTreeNodes arguments{column_node->clone(), const_value}; + QueryTreeNodes arguments{column_node->clone(), constant_node->clone()}; equal->getArguments().getNodes() = std::move(arguments); equal->resolveAsFunction(equal_resolver); node = equal; diff --git a/src/Core/SettingsChangesHistory.h b/src/Core/SettingsChangesHistory.h index 8e2b2915c2a..886dce72176 100644 --- a/src/Core/SettingsChangesHistory.h +++ b/src/Core/SettingsChangesHistory.h @@ -96,6 +96,7 @@ static std::map sett {"parallel_replicas_allow_in_with_subquery", false, true, "If true, subquery for IN will be executed on every follower replica"}, {"filesystem_cache_reserve_space_wait_lock_timeout_milliseconds", 1000, 1000, "Wait time to lock cache for sapce reservation in filesystem cache"}, {"max_parser_backtracks", 0, 1000000, "Limiting the complexity of parsing"}, + {"optimize_in_to_equal", false, true, "Convert in single value to equal"}, }}, {"24.2", {{"allow_suspicious_variant_types", true, false, "Don't allow creating Variant type with suspicious variants by default"}, {"validate_experimental_and_suspicious_types_inside_nested_types", false, true, "Validate usage of experimental and suspicious types inside nested types"}, diff --git a/tests/performance/function_in.xml b/tests/performance/function_in.xml index 16e6bb91469..af4f8737ba7 100644 --- a/tests/performance/function_in.xml +++ b/tests/performance/function_in.xml @@ -21,10 +21,8 @@ ENGINE = Memory insert into t_nullable select ['aaaaaa','bbaaaa','ccaaaa','ddaaaa'][number % 101 + 1], ['aa','bb','cc','dd'][number % 100 + 1], ['aa','bb','cc','dd'][number % 102 + 1], number%10+1, number%10+2, number%10+3, number%10+4,number%10+5, number%6000+1, number%5000+2 from numbers_mt(30000000) - select * from t_nullable where key_string1 in ('aaaaaa') format Null select * from t_nullable where key_string1 in ('aaaaaa') format Null SETTINGS allow_experimental_analyzer=1 - select * from t_nullable where key_string2 in ('3') format Null select * from t_nullable where key_string2 in ('3') format Null SETTINGS allow_experimental_analyzer=1 drop table if exists t_nullable - \ No newline at end of file +