From 2ebfd01c2ee712ebe597daa345932b971587b9ca Mon Sep 17 00:00:00 2001 From: Robert Schulze Date: Fri, 24 Jun 2022 15:20:03 +0200 Subject: [PATCH] Cosmetics: Pull out settings variable --- src/Functions/FunctionsMultiStringFuzzySearch.h | 10 +++++----- src/Functions/FunctionsMultiStringSearch.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Functions/FunctionsMultiStringFuzzySearch.h b/src/Functions/FunctionsMultiStringFuzzySearch.h index 3c2c0e523ff..6c016c9d6cb 100644 --- a/src/Functions/FunctionsMultiStringFuzzySearch.h +++ b/src/Functions/FunctionsMultiStringFuzzySearch.h @@ -36,12 +36,12 @@ public: static constexpr auto name = Impl::name; static FunctionPtr create(ContextPtr context) { - if (Impl::is_using_hyperscan && !context->getSettingsRef().allow_hyperscan) - throw Exception( - "Hyperscan functions are disabled, because setting 'allow_hyperscan' is set to 0", ErrorCodes::FUNCTION_NOT_ALLOWED); + const auto & settings = context->getSettingsRef(); - return std::make_shared( - context->getSettingsRef().max_hyperscan_regexp_length, context->getSettingsRef().max_hyperscan_regexp_total_length); + if (Impl::is_using_hyperscan && !settings.allow_hyperscan) + throw Exception("Hyperscan functions are disabled, because setting 'allow_hyperscan' is set to 0", ErrorCodes::FUNCTION_NOT_ALLOWED); + + return std::make_shared(settings.max_hyperscan_regexp_length, settings.max_hyperscan_regexp_total_length); } FunctionsMultiStringFuzzySearch(size_t max_hyperscan_regexp_length_, size_t max_hyperscan_regexp_total_length_) diff --git a/src/Functions/FunctionsMultiStringSearch.h b/src/Functions/FunctionsMultiStringSearch.h index 6ab85e632e4..0286e119608 100644 --- a/src/Functions/FunctionsMultiStringSearch.h +++ b/src/Functions/FunctionsMultiStringSearch.h @@ -49,12 +49,12 @@ public: static constexpr auto name = Impl::name; static FunctionPtr create(ContextPtr context) { - if (Impl::is_using_hyperscan && !context->getSettingsRef().allow_hyperscan) - throw Exception( - "Hyperscan functions are disabled, because setting 'allow_hyperscan' is set to 0", ErrorCodes::FUNCTION_NOT_ALLOWED); + const auto & settings = context->getSettingsRef(); - return std::make_shared( - context->getSettingsRef().max_hyperscan_regexp_length, context->getSettingsRef().max_hyperscan_regexp_total_length); + if (Impl::is_using_hyperscan && !settings.allow_hyperscan) + throw Exception("Hyperscan functions are disabled, because setting 'allow_hyperscan' is set to 0", ErrorCodes::FUNCTION_NOT_ALLOWED); + + return std::make_shared(settings.max_hyperscan_regexp_length, settings.max_hyperscan_regexp_total_length); } FunctionsMultiStringSearch(size_t max_hyperscan_regexp_length_, size_t max_hyperscan_regexp_total_length_)