mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Apply linter changes
This commit is contained in:
parent
ce4d88851a
commit
67c1e89d90
@ -116,7 +116,6 @@ Checks: [
|
||||
'-readability-avoid-unconditional-preprocessor-if',
|
||||
'-readability-braces-around-statements',
|
||||
'-readability-convert-member-functions-to-static',
|
||||
'-readability-else-after-return',
|
||||
'-readability-function-cognitive-complexity',
|
||||
'-readability-function-size',
|
||||
'-readability-identifier-length',
|
||||
|
@ -110,7 +110,6 @@ struct DecomposedFloat
|
||||
{
|
||||
if (!isNegative())
|
||||
return rhs > 0 ? -1 : 1;
|
||||
else
|
||||
return rhs >= 0 ? -1 : 1;
|
||||
}
|
||||
|
||||
@ -128,7 +127,6 @@ struct DecomposedFloat
|
||||
|
||||
if (mantissa() == 0)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -169,7 +167,6 @@ struct DecomposedFloat
|
||||
/// Float has no fractional part means that the numbers are equal.
|
||||
if (large_and_always_integer || (mantissa() & ((1ULL << (Traits::mantissa_bits - normalizedExponent())) - 1)) == 0)
|
||||
return 0;
|
||||
else
|
||||
/// Float has fractional part means its abs value is larger.
|
||||
return isNegative() ? -1 : 1;
|
||||
}
|
||||
|
@ -205,7 +205,6 @@ JSON::ElementType JSON::getType() const
|
||||
Pos after_string = skipString();
|
||||
if (after_string < ptr_end && *after_string == ':')
|
||||
return TYPE_NAME_VALUE_PAIR;
|
||||
else
|
||||
return TYPE_STRING;
|
||||
}
|
||||
default:
|
||||
@ -474,7 +473,6 @@ JSON::Pos JSON::searchField(const char * data, size_t size) const
|
||||
|
||||
if (it == end())
|
||||
return nullptr;
|
||||
else
|
||||
return it->data();
|
||||
}
|
||||
|
||||
@ -487,7 +485,7 @@ bool JSON::hasEscapes() const
|
||||
|
||||
if (*pos == '"')
|
||||
return false;
|
||||
else if (*pos == '\\')
|
||||
if (*pos == '\\')
|
||||
return true;
|
||||
throw JSONException("JSON: unexpected end of data.");
|
||||
}
|
||||
@ -503,7 +501,7 @@ bool JSON::hasSpecialChars() const
|
||||
|
||||
if (*pos == '"')
|
||||
return false;
|
||||
else if (pos < ptr_end)
|
||||
if (pos < ptr_end)
|
||||
return true;
|
||||
throw JSONException("JSON: unexpected end of data.");
|
||||
}
|
||||
@ -682,9 +680,8 @@ double JSON::toDouble() const
|
||||
|
||||
if (type == TYPE_NUMBER)
|
||||
return getDouble();
|
||||
else if (type == TYPE_STRING)
|
||||
if (type == TYPE_STRING)
|
||||
return JSON(ptr_begin + 1, ptr_end, level + 1).getDouble();
|
||||
else
|
||||
throw JSONException("JSON: cannot convert value to double.");
|
||||
}
|
||||
|
||||
@ -694,9 +691,8 @@ Int64 JSON::toInt() const
|
||||
|
||||
if (type == TYPE_NUMBER)
|
||||
return getInt();
|
||||
else if (type == TYPE_STRING)
|
||||
if (type == TYPE_STRING)
|
||||
return JSON(ptr_begin + 1, ptr_end, level + 1).getInt();
|
||||
else
|
||||
throw JSONException("JSON: cannot convert value to signed integer.");
|
||||
}
|
||||
|
||||
@ -706,9 +702,8 @@ UInt64 JSON::toUInt() const
|
||||
|
||||
if (type == TYPE_NUMBER)
|
||||
return getUInt();
|
||||
else if (type == TYPE_STRING)
|
||||
if (type == TYPE_STRING)
|
||||
return JSON(ptr_begin + 1, ptr_end, level + 1).getUInt();
|
||||
else
|
||||
throw JSONException("JSON: cannot convert value to unsigned integer.");
|
||||
}
|
||||
|
||||
@ -718,12 +713,10 @@ std::string JSON::toString() const
|
||||
|
||||
if (type == TYPE_STRING)
|
||||
return getString();
|
||||
else
|
||||
{
|
||||
|
||||
Pos pos = skipElement();
|
||||
return std::string(ptr_begin, pos - ptr_begin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JSON::iterator JSON::iterator::begin() const
|
||||
|
@ -203,9 +203,7 @@ T JSON::getWithDefault(const std::string & key, const T & default_) const
|
||||
|
||||
if (key_json.isType<T>())
|
||||
return key_json.get<T>();
|
||||
else
|
||||
return default_;
|
||||
}
|
||||
else
|
||||
return default_;
|
||||
}
|
||||
|
@ -151,19 +151,19 @@ inline bool memequalWide(const char * p1, const char * p2, size_t size)
|
||||
return unalignedLoad<uint64_t>(p1) == unalignedLoad<uint64_t>(p2)
|
||||
&& unalignedLoad<uint64_t>(p1 + size - 8) == unalignedLoad<uint64_t>(p2 + size - 8);
|
||||
}
|
||||
else if (size >= 4)
|
||||
if (size >= 4)
|
||||
{
|
||||
/// Chunks of 4..7 bytes.
|
||||
return unalignedLoad<uint32_t>(p1) == unalignedLoad<uint32_t>(p2)
|
||||
&& unalignedLoad<uint32_t>(p1 + size - 4) == unalignedLoad<uint32_t>(p2 + size - 4);
|
||||
}
|
||||
else if (size >= 2)
|
||||
if (size >= 2)
|
||||
{
|
||||
/// Chunks of 2..3 bytes.
|
||||
return unalignedLoad<uint16_t>(p1) == unalignedLoad<uint16_t>(p2)
|
||||
&& unalignedLoad<uint16_t>(p1 + size - 2) == unalignedLoad<uint16_t>(p2 + size - 2);
|
||||
}
|
||||
else if (size >= 1)
|
||||
if (size >= 1)
|
||||
{
|
||||
/// A single byte.
|
||||
return *p1 == *p2;
|
||||
|
@ -53,10 +53,9 @@ void argsToConfig(const Poco::Util::Application::ArgVec & argv,
|
||||
key = arg.substr(key_start);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
key = "";
|
||||
}
|
||||
|
||||
|
||||
if (key_start == std::string::npos)
|
||||
continue;
|
||||
|
@ -330,7 +330,6 @@ inline const char * find_first_symbols_dispatch(const char * begin, const char *
|
||||
#if defined(__SSE4_2__)
|
||||
if (sizeof...(symbols) >= 5)
|
||||
return find_first_symbols_sse42<positive, return_mode, sizeof...(symbols), symbols...>(begin, end);
|
||||
else
|
||||
#endif
|
||||
return find_first_symbols_sse2<positive, return_mode, symbols...>(begin, end);
|
||||
}
|
||||
@ -341,7 +340,6 @@ inline const char * find_first_symbols_dispatch(const std::string_view haystack,
|
||||
#if defined(__SSE4_2__)
|
||||
if (symbols.str.size() >= 5)
|
||||
return find_first_symbols_sse42<positive, return_mode>(haystack.begin(), haystack.end(), symbols);
|
||||
else
|
||||
#endif
|
||||
return find_first_symbols_sse2<positive, return_mode>(haystack.begin(), haystack.end(), symbols.str.data(), symbols.str.size());
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ std::optional<uint64_t> getCgroupsV2MemoryLimit()
|
||||
uint64_t value;
|
||||
if (setting_file >> value)
|
||||
return {value};
|
||||
else
|
||||
return {}; /// e.g. the cgroups default "max"
|
||||
}
|
||||
current_cgroup = current_cgroup.parent_path();
|
||||
|
@ -445,8 +445,7 @@ private:
|
||||
shutdown = true;
|
||||
throw;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
std::cerr << getCurrentExceptionMessage(print_stacktrace,
|
||||
true /*check embedded stack trace*/) << std::endl;
|
||||
|
||||
@ -454,7 +453,6 @@ private:
|
||||
++comparison_info_per_interval[info_index]->errors;
|
||||
++comparison_info_total[info_index]->errors;
|
||||
}
|
||||
}
|
||||
// Count failed queries toward executed, so that we'd reach
|
||||
// max_iterations even if every run fails.
|
||||
++queries_executed;
|
||||
|
@ -479,14 +479,11 @@ void Client::connect()
|
||||
break;
|
||||
}
|
||||
catch (const Exception & e)
|
||||
{
|
||||
if (e.code() == DB::ErrorCodes::AUTHENTICATION_FAILED)
|
||||
{
|
||||
/// This problem can't be fixed with reconnection so it is not attempted
|
||||
if (e.code() == DB::ErrorCodes::AUTHENTICATION_FAILED)
|
||||
throw;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (attempted_address_index == hosts_and_ports.size() - 1)
|
||||
throw;
|
||||
|
||||
@ -503,7 +500,6 @@ void Client::connect()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server_version = toString(server_version_major) + "." + toString(server_version_minor) + "." + toString(server_version_patch);
|
||||
load_suggestions = is_interactive && (server_revision >= Suggest::MIN_SERVER_REVISION) && !config().getBool("disable_suggestion", false);
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
path_from,
|
||||
disk_from.getDisk()->getName());
|
||||
}
|
||||
else if (disk_from.getDisk()->isFile(path_from))
|
||||
if (disk_from.getDisk()->isFile(path_from))
|
||||
{
|
||||
auto target_location = getTargetLocation(path_from, disk_to, path_to);
|
||||
if (!disk_to.getDisk()->exists(target_location) || disk_to.getDisk()->isFile(target_location))
|
||||
@ -77,7 +77,7 @@ public:
|
||||
{
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "cannot overwrite non-directory {} with directory {}", path_to, target_location);
|
||||
}
|
||||
else if (!disk_to.getDisk()->exists(target_location))
|
||||
if (!disk_to.getDisk()->exists(target_location))
|
||||
{
|
||||
disk_to.getDisk()->createDirectory(target_location);
|
||||
}
|
||||
|
@ -72,13 +72,9 @@ private:
|
||||
auto path = [&]() -> String
|
||||
{
|
||||
if (relative_path.ends_with("/"))
|
||||
{
|
||||
return relative_path + file_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return relative_path + "/" + file_name;
|
||||
}
|
||||
}();
|
||||
if (disk.isDirectory(path))
|
||||
{
|
||||
|
@ -53,12 +53,10 @@ public:
|
||||
{
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "cannot move '{}' to '{}': Directory not empty", path_from, target_location);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
disk.getDisk()->moveDirectory(path_from, target_location);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!disk.getDisk()->exists(path_from))
|
||||
{
|
||||
throw Exception(
|
||||
|
@ -32,17 +32,15 @@ public:
|
||||
{
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Path {} on disk {} doesn't exist", path, disk.getDisk()->getName());
|
||||
}
|
||||
else if (disk.getDisk()->isDirectory(path))
|
||||
if (disk.getDisk()->isDirectory(path))
|
||||
{
|
||||
if (!recursive)
|
||||
{
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "cannot remove '{}': Is a directory", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
disk.getDisk()->removeRecursive(path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
disk.getDisk()->removeFileIfExists(path);
|
||||
|
@ -33,14 +33,10 @@ public:
|
||||
auto in = [&]() -> std::unique_ptr<ReadBufferFromFileBase>
|
||||
{
|
||||
if (!path_from.has_value())
|
||||
{
|
||||
return std::make_unique<ReadBufferFromFileDescriptor>(STDIN_FILENO);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
String relative_path_from = disk.getRelativeFromRoot(path_from.value());
|
||||
return disk.getDisk()->readFile(relative_path_from, getReadSettings());
|
||||
}
|
||||
}();
|
||||
|
||||
auto out = disk.getDisk()->writeFile(path_to);
|
||||
|
@ -127,13 +127,12 @@ std::vector<String> DisksApp::getCompletions(const String & prefix) const
|
||||
}
|
||||
return getEmptyCompletion(command->command_name);
|
||||
}
|
||||
else if (arguments.size() == 1)
|
||||
if (arguments.size() == 1)
|
||||
{
|
||||
String command_prefix = arguments[0];
|
||||
return getCommandsToComplete(command_prefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
String last_token = arguments.back();
|
||||
CommandPtr command;
|
||||
try
|
||||
@ -144,23 +143,17 @@ std::vector<String> DisksApp::getCompletions(const String & prefix) const
|
||||
{
|
||||
return {last_token};
|
||||
}
|
||||
|
||||
std::vector<String> answer = {};
|
||||
if (command->command_name == "help")
|
||||
{
|
||||
return getCommandsToComplete(last_token);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
answer = [&]() -> std::vector<String>
|
||||
{
|
||||
if (multidisk_commands.contains(command->command_name))
|
||||
{
|
||||
return client->getAllFilesByPatternFromAllDisks(last_token);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return client->getCurrentDiskWithPath().getAllFilesByPattern(last_token);
|
||||
}
|
||||
}();
|
||||
|
||||
for (const auto & disk_name : client->getAllDiskNames())
|
||||
@ -178,18 +171,15 @@ std::vector<String> DisksApp::getCompletions(const String & prefix) const
|
||||
answer.push_back(option_sign);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!answer.empty())
|
||||
{
|
||||
std::sort(answer.begin(), answer.end());
|
||||
return answer;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return {last_token};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DisksApp::processQueryText(const String & text)
|
||||
{
|
||||
@ -210,11 +200,11 @@ bool DisksApp::processQueryText(const String & text)
|
||||
catch (DB::Exception & err)
|
||||
{
|
||||
int code = getCurrentExceptionCode();
|
||||
|
||||
if (code == ErrorCodes::LOGICAL_ERROR)
|
||||
{
|
||||
throw std::move(err);
|
||||
}
|
||||
else if (code == ErrorCodes::BAD_ARGUMENTS)
|
||||
|
||||
if (code == ErrorCodes::BAD_ARGUMENTS)
|
||||
{
|
||||
std::cerr << err.message() << "\n"
|
||||
<< "\n";
|
||||
|
@ -49,11 +49,9 @@ std::vector<String> DiskWithPath::listAllFilesByPath(const String & any_path) co
|
||||
disk->listFiles(getRelativeFromRoot(any_path), file_names);
|
||||
return file_names;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<String> DiskWithPath::getAllFilesByPattern(const String & pattern) const
|
||||
{
|
||||
@ -61,23 +59,15 @@ std::vector<String> DiskWithPath::getAllFilesByPattern(const String & pattern) c
|
||||
{
|
||||
auto slash_pos = pattern.find_last_of('/');
|
||||
if (slash_pos >= pattern.size())
|
||||
{
|
||||
return {"", pattern};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return {pattern.substr(0, slash_pos + 1), pattern.substr(slash_pos + 1, pattern.size() - slash_pos - 1)};
|
||||
}
|
||||
}();
|
||||
|
||||
if (!isDirectory(path_before))
|
||||
{
|
||||
return {};
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<String> file_names = listAllFilesByPath(path_before);
|
||||
|
||||
std::vector<String> file_names = listAllFilesByPath(path_before);
|
||||
std::vector<String> answer;
|
||||
|
||||
for (const auto & file_name : file_names)
|
||||
@ -93,7 +83,6 @@ std::vector<String> DiskWithPath::getAllFilesByPattern(const String & pattern) c
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
};
|
||||
|
||||
void DiskWithPath::setPath(const String & any_path)
|
||||
|
@ -39,13 +39,9 @@ DiskWithPath & ICommand::getDiskWithPath(DisksClient & client, const CommandLine
|
||||
{
|
||||
auto disk_name = getValueFromCommandLineOptionsWithOptional<String>(options, name);
|
||||
if (disk_name.has_value())
|
||||
{
|
||||
return client.getDiskWithPath(disk_name.value());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return client.getCurrentDiskWithPath();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -63,40 +63,28 @@ protected:
|
||||
static T getValueFromCommandLineOptionsThrow(const CommandLineOptions & options, const String & name)
|
||||
{
|
||||
if (options.count(name))
|
||||
{
|
||||
return getValueFromCommandLineOptions<T>(options, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
throw DB::Exception(ErrorCodes::BAD_ARGUMENTS, "Mandatory argument '{}' is missing", name);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T getValueFromCommandLineOptionsWithDefault(const CommandLineOptions & options, const String & name, const T & default_value)
|
||||
{
|
||||
if (options.count(name))
|
||||
{
|
||||
return getValueFromCommandLineOptions<T>(options, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return default_value;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static std::optional<T> getValueFromCommandLineOptionsWithOptional(const CommandLineOptions & options, const String & name)
|
||||
{
|
||||
if (options.count(name))
|
||||
{
|
||||
return std::optional{getValueFromCommandLineOptions<T>(options, name)};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
DiskWithPath & getDiskWithPath(DisksClient & client, const CommandLineOptions & options, const String & name);
|
||||
|
||||
|
@ -110,7 +110,7 @@ static auto executeScript(const std::string & command, bool throw_on_error = fal
|
||||
sh->wait();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
||||
return sh->tryWait();
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@ CatBoostLibraryHandlerPtr CatBoostLibraryHandlerFactory::tryGetModel(const Strin
|
||||
|
||||
if (found)
|
||||
return handler->second;
|
||||
else
|
||||
{
|
||||
|
||||
if (create_if_not_found)
|
||||
{
|
||||
auto new_handler = std::make_shared<CatBoostLibraryHandler>(library_path, model_path);
|
||||
@ -37,7 +36,6 @@ CatBoostLibraryHandlerPtr CatBoostLibraryHandlerFactory::tryGetModel(const Strin
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CatBoostLibraryHandlerFactory::removeModel(const String & model_path)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ std::unique_ptr<HTTPRequestHandler> LibraryBridgeHandlerFactory::createRequestHa
|
||||
{
|
||||
if (uri.getPath() == "/extdict_ping")
|
||||
return std::make_unique<ExternalDictionaryLibraryBridgeExistsHandler>(getContext());
|
||||
else if (uri.getPath() == "/catboost_ping")
|
||||
if (uri.getPath() == "/catboost_ping")
|
||||
return std::make_unique<CatBoostLibraryBridgeExistsHandler>(getContext());
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ std::unique_ptr<HTTPRequestHandler> LibraryBridgeHandlerFactory::createRequestHa
|
||||
{
|
||||
if (uri.getPath() == "/extdict_request")
|
||||
return std::make_unique<ExternalDictionaryLibraryBridgeRequestHandler>(getContext());
|
||||
else if (uri.getPath() == "/catboost_request")
|
||||
if (uri.getPath() == "/catboost_request")
|
||||
return std::make_unique<CatBoostLibraryBridgeRequestHandler>(getContext());
|
||||
}
|
||||
|
||||
|
@ -158,12 +158,10 @@ void ExternalDictionaryLibraryBridgeRequestHandler::handleRequest(HTTPServerRequ
|
||||
out.finalize();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
LOG_TRACE(log, "Cannot clone from dictionary with id: {}, will call extDict_libNew instead", from_dictionary_id);
|
||||
lib_new = true;
|
||||
}
|
||||
}
|
||||
if (lib_new)
|
||||
{
|
||||
auto & read_buf = request.getStream();
|
||||
|
@ -231,7 +231,7 @@ static Int64 transformSigned(Int64 x, UInt64 seed)
|
||||
{
|
||||
if (x >= 0)
|
||||
return transform(x, seed);
|
||||
else
|
||||
|
||||
return -transform(-x, seed); /// It works Ok even for minimum signed number.
|
||||
}
|
||||
|
||||
@ -1105,7 +1105,7 @@ public:
|
||||
{
|
||||
if (isUInt(data_type))
|
||||
return std::make_unique<UnsignedIntegerModel>(seed);
|
||||
else
|
||||
|
||||
return std::make_unique<SignedIntegerModel>(seed);
|
||||
}
|
||||
|
||||
|
@ -39,11 +39,11 @@ IdentifierQuotingStyle getQuotingStyle(nanodbc::ConnectionHolderPtr connection)
|
||||
auto identifier_quote = getIdentifierQuote(connection);
|
||||
if (identifier_quote.empty())
|
||||
return IdentifierQuotingStyle::Backticks;
|
||||
else if (identifier_quote[0] == '`')
|
||||
if (identifier_quote[0] == '`')
|
||||
return IdentifierQuotingStyle::Backticks;
|
||||
else if (identifier_quote[0] == '"')
|
||||
if (identifier_quote[0] == '"')
|
||||
return IdentifierQuotingStyle::DoubleQuotes;
|
||||
else
|
||||
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Can not map quote identifier '{}' to IdentifierQuotingStyle value", identifier_quote);
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ std::string validateODBCConnectionString(const std::string & connection_string)
|
||||
|
||||
if (*pos == '{')
|
||||
return read_escaped_value();
|
||||
else
|
||||
|
||||
return read_plain_value();
|
||||
};
|
||||
|
||||
@ -206,13 +206,11 @@ std::string validateODBCConnectionString(const std::string & connection_string)
|
||||
reconstructed_connection_string.append(value_pos, next_pos - value_pos);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
reconstructed_connection_string.append(value_pos, next_pos - value_pos);
|
||||
reconstructed_connection_string.append("}}");
|
||||
value_pos = next_pos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
reconstructed_connection_string += '}';
|
||||
};
|
||||
|
@ -116,16 +116,14 @@ namespace
|
||||
reading_dependents = false;
|
||||
continue;
|
||||
}
|
||||
else if (line == "DEPENDENTS")
|
||||
if (line == "DEPENDENTS")
|
||||
{
|
||||
reading_dependents = true;
|
||||
reading_dependencies = false;
|
||||
continue;
|
||||
}
|
||||
else if (line.empty())
|
||||
{
|
||||
if (line.empty())
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t separator1 = line.find('\t');
|
||||
size_t separator2 = line.find('\t', separator1 + 1);
|
||||
|
@ -134,7 +134,7 @@ public:
|
||||
"' registered for user-defined settings",
|
||||
String{setting_name}, boost::algorithm::join(registered_prefixes, "' or '"));
|
||||
}
|
||||
else
|
||||
|
||||
throw Exception(ErrorCodes::UNKNOWN_SETTING, "Unknown setting '{}'", String{setting_name});
|
||||
}
|
||||
|
||||
@ -830,7 +830,6 @@ std::shared_ptr<const EnabledQuota> AccessControl::getAuthenticationQuota(
|
||||
quota_key,
|
||||
throw_if_client_key_empty);
|
||||
}
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1483,16 +1483,16 @@ bool AccessRights::isGrantedImplHelper(const AccessRightsElement & element) cons
|
||||
{
|
||||
if (element.anyParameter())
|
||||
return isGrantedImpl<grant_option, wildcard>(element.access_flags);
|
||||
else
|
||||
|
||||
return isGrantedImpl<grant_option, wildcard>(element.access_flags, element.parameter);
|
||||
}
|
||||
else if (element.anyDatabase())
|
||||
if (element.anyDatabase())
|
||||
return isGrantedImpl<grant_option, wildcard>(element.access_flags);
|
||||
else if (element.anyTable())
|
||||
if (element.anyTable())
|
||||
return isGrantedImpl<grant_option, wildcard>(element.access_flags, element.database);
|
||||
else if (element.anyColumn())
|
||||
if (element.anyColumn())
|
||||
return isGrantedImpl<grant_option, wildcard>(element.access_flags, element.database, element.table);
|
||||
else
|
||||
|
||||
return isGrantedImpl<grant_option, wildcard>(element.access_flags, element.database, element.table, element.columns);
|
||||
}
|
||||
|
||||
@ -1503,17 +1503,15 @@ bool AccessRights::isGrantedImpl(const AccessRightsElement & element) const
|
||||
{
|
||||
if (element.grant_option)
|
||||
return isGrantedImplHelper<true, true>(element);
|
||||
else
|
||||
|
||||
return isGrantedImplHelper<grant_option, true>(element);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (element.grant_option)
|
||||
return isGrantedImplHelper<true, wildcard>(element);
|
||||
else
|
||||
|
||||
return isGrantedImplHelper<grant_option, wildcard>(element);
|
||||
}
|
||||
}
|
||||
|
||||
template <bool grant_option, bool wildcard>
|
||||
bool AccessRights::isGrantedImpl(const AccessRightsElements & elements) const
|
||||
|
@ -501,10 +501,9 @@ AuthenticationData AuthenticationData::fromAST(const ASTAuthenticationData & que
|
||||
auth_data.setPasswordHashBinary(AuthenticationData::Util::stringToDigest(value));
|
||||
return auth_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
auth_data.setPasswordHashHex(value);
|
||||
}
|
||||
|
||||
|
||||
if (query.type == AuthenticationType::SHA256_PASSWORD && args_size == 2)
|
||||
{
|
||||
|
@ -247,7 +247,6 @@ namespace
|
||||
const auto & unused_node = *(owned_nodes.begin()->second);
|
||||
if (unused_node.node_type == UNKNOWN)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Parent group '{}' not found", unused_node.keyword);
|
||||
else
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Access type '{}' should have parent group", unused_node.keyword);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace
|
||||
{
|
||||
if (addr.family() == IPAddress::Family::IPv4 && addr_v6 == toIPv6(addr))
|
||||
return true;
|
||||
else if (addr.family() == IPAddress::Family::IPv6 && addr_v6 == addr)
|
||||
if (addr.family() == IPAddress::Family::IPv6 && addr_v6 == addr)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -267,9 +267,8 @@ String AllowedClientHosts::IPSubnet::toString() const
|
||||
unsigned int prefix_length = mask.prefixLength();
|
||||
if (isMaskAllBitsOne())
|
||||
return prefix.toString();
|
||||
else if (IPAddress{prefix_length, mask.family()} == mask)
|
||||
if (IPAddress{prefix_length, mask.family()} == mask)
|
||||
return fs::path(prefix.toString()) / std::to_string(prefix_length);
|
||||
else
|
||||
return fs::path(prefix.toString()) / mask.toString();
|
||||
}
|
||||
|
||||
@ -575,11 +574,10 @@ bool AllowedClientHosts::contains(const IPAddress & client_address) const
|
||||
parseLikePattern(pattern, subnet, name, name_regexp);
|
||||
if (subnet)
|
||||
return check_subnet(*subnet);
|
||||
else if (name)
|
||||
if (name)
|
||||
return check_name(*name);
|
||||
else if (name_regexp)
|
||||
if (name_regexp)
|
||||
return check_name_regexp(*name_regexp);
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,6 @@ String QuotaTypeInfo::valueToString(QuotaValue value) const
|
||||
{
|
||||
if (!(value % output_denominator))
|
||||
return std::to_string(value / output_denominator);
|
||||
else
|
||||
return toString(static_cast<double>(value) / output_denominator);
|
||||
}
|
||||
|
||||
@ -36,7 +35,6 @@ QuotaValue QuotaTypeInfo::stringToValue(const String & str) const
|
||||
{
|
||||
if (output_denominator == 1)
|
||||
return static_cast<QuotaValue>(parse<UInt64>(str));
|
||||
else
|
||||
return static_cast<QuotaValue>(parse<Float64>(str) * output_denominator);
|
||||
}
|
||||
|
||||
|
@ -728,7 +728,6 @@ bool ContextAccess::checkAccessImplHelper(const ContextPtr & context, AccessFlag
|
||||
"For queries over HTTP, method GET implies readonly. "
|
||||
"You should use method POST for modifying queries");
|
||||
}
|
||||
else
|
||||
return access_denied(ErrorCodes::READONLY, "{}: Cannot execute query in readonly mode");
|
||||
}
|
||||
}
|
||||
@ -770,16 +769,16 @@ bool ContextAccess::checkAccessImplHelper(const ContextPtr & context, const Acce
|
||||
{
|
||||
if (element.anyParameter())
|
||||
return checkAccessImpl<throw_if_denied, grant_option, wildcard>(context, element.access_flags);
|
||||
else
|
||||
|
||||
return checkAccessImpl<throw_if_denied, grant_option, wildcard>(context, element.access_flags, element.parameter);
|
||||
}
|
||||
else if (element.anyDatabase())
|
||||
if (element.anyDatabase())
|
||||
return checkAccessImpl<throw_if_denied, grant_option, wildcard>(context, element.access_flags);
|
||||
else if (element.anyTable())
|
||||
if (element.anyTable())
|
||||
return checkAccessImpl<throw_if_denied, grant_option, wildcard>(context, element.access_flags, element.database);
|
||||
else if (element.anyColumn())
|
||||
if (element.anyColumn())
|
||||
return checkAccessImpl<throw_if_denied, grant_option, wildcard>(context, element.access_flags, element.database, element.table);
|
||||
else
|
||||
|
||||
return checkAccessImpl<throw_if_denied, grant_option, wildcard>(context, element.access_flags, element.database, element.table, element.columns);
|
||||
}
|
||||
|
||||
@ -790,17 +789,15 @@ bool ContextAccess::checkAccessImpl(const ContextPtr & context, const AccessRigh
|
||||
{
|
||||
if (element.grant_option)
|
||||
return checkAccessImplHelper<throw_if_denied, true, true>(context, element);
|
||||
else
|
||||
|
||||
return checkAccessImplHelper<throw_if_denied, grant_option, true>(context, element);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (element.grant_option)
|
||||
return checkAccessImplHelper<throw_if_denied, true, wildcard>(context, element);
|
||||
else
|
||||
|
||||
return checkAccessImplHelper<throw_if_denied, grant_option, wildcard>(context, element);
|
||||
}
|
||||
}
|
||||
|
||||
template <bool throw_if_denied, bool grant_option, bool wildcard>
|
||||
bool ContextAccess::checkAccessImpl(const ContextPtr & context, const AccessRightsElements & elements) const
|
||||
|
@ -89,9 +89,8 @@ bool operator ==(const ContextAccessParams & left, const ContextAccessParams & r
|
||||
{
|
||||
if (!x)
|
||||
return !y;
|
||||
else if (!y)
|
||||
if (!y)
|
||||
return false;
|
||||
else
|
||||
return *x == *y;
|
||||
}
|
||||
else
|
||||
@ -132,22 +131,20 @@ bool operator <(const ContextAccessParams & left, const ContextAccessParams & ri
|
||||
{
|
||||
if (!x)
|
||||
return y ? -1 : 0;
|
||||
else if (!y)
|
||||
if (!y)
|
||||
return 1;
|
||||
else if (*x == *y)
|
||||
if (*x == *y)
|
||||
return 0;
|
||||
else if (*x < *y)
|
||||
if (*x < *y)
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x == y)
|
||||
return 0;
|
||||
else if (x < y)
|
||||
if (x < y)
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
@ -166,7 +166,6 @@ void KerberosInit::init(const String & keytab_file, const String & principal, co
|
||||
ret = krb5_get_init_creds_keytab(k5.ctx, &my_creds, k5.me, keytab, 0, nullptr, options);
|
||||
if (ret)
|
||||
throw Exception(ErrorCodes::KERBEROS_ERROR, "Error in getting initial credentials: {}", fmtError(ret));
|
||||
else
|
||||
LOG_TRACE(log, "Got initial credentials");
|
||||
}
|
||||
else
|
||||
|
@ -330,10 +330,7 @@ std::set<String> LDAPAccessStorage::mapExternalRolesNoLock(const LDAPClient::Sea
|
||||
|
||||
for (const auto & external_role : external_role_set)
|
||||
{
|
||||
if (
|
||||
prefix.size() < external_role.size() &&
|
||||
external_role.compare(0, prefix.size(), prefix) == 0
|
||||
)
|
||||
if (prefix.size() < external_role.size() && external_role.starts_with(prefix))
|
||||
{
|
||||
role_names.emplace(external_role, prefix.size());
|
||||
}
|
||||
|
@ -62,7 +62,6 @@ String QuotaCache::QuotaInfo::calculateKey(const EnabledQuota & enabled, bool th
|
||||
"Quota {} (for user {}) requires a client supplied key.",
|
||||
quota->getName(),
|
||||
params.user_name);
|
||||
else
|
||||
return ""; // Authentication quota has no client key at time of authentication.
|
||||
}
|
||||
case QuotaKeyType::CLIENT_KEY_OR_USER_NAME:
|
||||
|
@ -80,15 +80,13 @@ void RolesOrUsersSet::init(const ASTRolesOrUsersSet & ast, const AccessControl *
|
||||
return *id;
|
||||
return access_control->getID<Role>(name);
|
||||
}
|
||||
else if (ast.allow_users)
|
||||
if (ast.allow_users)
|
||||
{
|
||||
return access_control->getID<User>(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
assert(ast.allow_roles);
|
||||
return access_control->getID<Role>(name);
|
||||
}
|
||||
};
|
||||
|
||||
if (!ast.names.empty() && !all)
|
||||
|
@ -28,7 +28,7 @@ SettingsAuthResponseParser::parse(const Poco::Net::HTTPResponse & response, std:
|
||||
try
|
||||
{
|
||||
Poco::Dynamic::Var json = parser.parse(*body_stream);
|
||||
Poco::JSON::Object::Ptr obj = json.extract<Poco::JSON::Object::Ptr>();
|
||||
const Poco::JSON::Object::Ptr & obj = json.extract<Poco::JSON::Object::Ptr>();
|
||||
Poco::JSON::Object::Ptr settings_obj = obj->getObject(settings_key);
|
||||
|
||||
if (settings_obj)
|
||||
|
@ -54,7 +54,6 @@ SettingSourceRestrictions getSettingSourceRestrictions(std::string_view name)
|
||||
auto settingConstraintIter = SETTINGS_SOURCE_RESTRICTIONS.find(name);
|
||||
if (settingConstraintIter != SETTINGS_SOURCE_RESTRICTIONS.end())
|
||||
return settingConstraintIter->second;
|
||||
else
|
||||
return SettingSourceRestrictions(); // allows everything
|
||||
}
|
||||
|
||||
@ -310,7 +309,6 @@ bool SettingsConstraints::Checker::check(SettingChange & change,
|
||||
{
|
||||
if (reaction == THROW_ON_VIOLATION)
|
||||
throw Exception(explain, code);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -335,7 +333,6 @@ bool SettingsConstraints::Checker::check(SettingChange & change,
|
||||
{
|
||||
if (reaction == THROW_ON_VIOLATION)
|
||||
throw Exception(ErrorCodes::SETTING_CONSTRAINT_VIOLATION, "Setting {} should not be changed", setting_name);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -351,7 +348,6 @@ bool SettingsConstraints::Checker::check(SettingChange & change,
|
||||
max_value,
|
||||
min_value,
|
||||
setting_name);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -362,7 +358,6 @@ bool SettingsConstraints::Checker::check(SettingChange & change,
|
||||
throw Exception(ErrorCodes::SETTING_CONSTRAINT_VIOLATION, "Setting {} shouldn't be less than {}",
|
||||
setting_name, applyVisitor(FieldVisitorToString(), min_value));
|
||||
}
|
||||
else
|
||||
change.value = min_value;
|
||||
}
|
||||
|
||||
@ -373,7 +368,6 @@ bool SettingsConstraints::Checker::check(SettingChange & change,
|
||||
throw Exception(ErrorCodes::SETTING_CONSTRAINT_VIOLATION, "Setting {} shouldn't be greater than {}",
|
||||
setting_name, applyVisitor(FieldVisitorToString(), max_value));
|
||||
}
|
||||
else
|
||||
change.value = max_value;
|
||||
}
|
||||
|
||||
@ -381,7 +375,6 @@ bool SettingsConstraints::Checker::check(SettingChange & change,
|
||||
{
|
||||
if (reaction == THROW_ON_VIOLATION)
|
||||
throw Exception(ErrorCodes::READONLY, "Setting {} is not allowed to be set by {}", setting_name, toString(source));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -649,7 +649,6 @@ namespace
|
||||
{
|
||||
if (users_without_row_policies_can_read_rows)
|
||||
continue;
|
||||
else
|
||||
filter = "1";
|
||||
}
|
||||
|
||||
|
@ -157,13 +157,13 @@ public:
|
||||
d.status = static_cast<Data::Status>(k);
|
||||
if (d.status == Data::Status::NotSet)
|
||||
return;
|
||||
else if (d.status == Data::Status::SetNull)
|
||||
if (d.status == Data::Status::SetNull)
|
||||
{
|
||||
if (!returns_nullable_type)
|
||||
throw Exception(ErrorCodes::INCORRECT_DATA, "Incorrect type (NULL) in non-nullable {}State", getName());
|
||||
return;
|
||||
}
|
||||
else if (d.status == Data::Status::SetOther)
|
||||
if (d.status == Data::Status::SetOther)
|
||||
{
|
||||
serialization->deserializeBinary(d.value, buf, {});
|
||||
return;
|
||||
|
@ -148,9 +148,8 @@ AggregateFunctionPtr createAggregateFunctionDeltaSum(
|
||||
if (isInteger(data_type) || isFloat(data_type))
|
||||
return AggregateFunctionPtr(createWithNumericType<AggregationFunctionDeltaSum>(
|
||||
*data_type, arguments, params));
|
||||
else
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Illegal type {} of argument for aggregate function {}",
|
||||
arguments[0]->getName(), name);
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Illegal type {} of argument for aggregate function {}", arguments[0]->getName(), name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,13 +137,12 @@ AggregateFunctionFactory::getAssociatedFunctionByNullsAction(const String & name
|
||||
{
|
||||
if (action == NullsAction::RESPECT_NULLS)
|
||||
{
|
||||
if (auto it = respect_nulls.find(name); it == respect_nulls.end())
|
||||
auto it = respect_nulls.find(name);
|
||||
if (it == respect_nulls.end())
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Function {} does not support RESPECT NULLS", name);
|
||||
else if (auto associated_it = aggregate_functions.find(it->second); associated_it != aggregate_functions.end())
|
||||
if (auto associated_it = aggregate_functions.find(it->second); associated_it != aggregate_functions.end())
|
||||
return {associated_it->second};
|
||||
else
|
||||
throw Exception(
|
||||
ErrorCodes::LOGICAL_ERROR, "Unable to find the function {} (equivalent to '{} RESPECT NULLS')", it->second, name);
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unable to find the function {} (equivalent to '{} RESPECT NULLS')", it->second, name);
|
||||
}
|
||||
|
||||
if (action == NullsAction::IGNORE_NULLS)
|
||||
@ -152,7 +151,6 @@ AggregateFunctionFactory::getAssociatedFunctionByNullsAction(const String & name
|
||||
{
|
||||
if (auto associated_it = aggregate_functions.find(it->second); associated_it != aggregate_functions.end())
|
||||
return {associated_it->second};
|
||||
else
|
||||
throw Exception(
|
||||
ErrorCodes::LOGICAL_ERROR, "Unable to find the function {} (equivalent to '{} IGNORE NULLS')", it->second, name);
|
||||
}
|
||||
@ -263,7 +261,6 @@ AggregateFunctionPtr AggregateFunctionFactory::getImpl(
|
||||
if (!hints.empty())
|
||||
throw Exception(ErrorCodes::UNKNOWN_AGGREGATE_FUNCTION,
|
||||
"Unknown aggregate function {}{}. Maybe you meant: {}", name, extra_info, toString(hints));
|
||||
else
|
||||
throw Exception(ErrorCodes::UNKNOWN_AGGREGATE_FUNCTION, "Unknown aggregate function {}{}", name, extra_info);
|
||||
}
|
||||
|
||||
|
@ -328,8 +328,7 @@ struct AggregateFunctionFlameGraphData
|
||||
list = list->next;
|
||||
return entry;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Entry * parent = list;
|
||||
while (parent->next && parent->next->size != size)
|
||||
parent = parent->next;
|
||||
@ -343,7 +342,6 @@ struct AggregateFunctionFlameGraphData
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void add(UInt64 ptr, Int64 size, const UInt64 * stack, size_t stack_size, Arena * arena)
|
||||
{
|
||||
|
@ -90,7 +90,6 @@ struct GroupArraySamplerData
|
||||
/// With a large number of values, we will generate random numbers several times slower.
|
||||
if (lim <= static_cast<UInt64>(pcg32_fast::max()))
|
||||
return rng() % lim;
|
||||
else
|
||||
return (static_cast<UInt64>(rng()) * (static_cast<UInt64>(pcg32::max()) + 1ULL) + static_cast<UInt64>(rng())) % lim;
|
||||
}
|
||||
|
||||
@ -797,8 +796,8 @@ AggregateFunctionPtr createAggregateFunctionGroupArray(
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "groupArrayLast make sense only with max_elems (groupArrayLast(max_elems)())");
|
||||
return createAggregateFunctionGroupArrayImpl<GroupArrayTrait</* Thas_limit= */ false, Tlast, /* Tsampler= */ Sampler::NONE>>(argument_types[0], parameters, max_elems, std::nullopt);
|
||||
}
|
||||
else
|
||||
return createAggregateFunctionGroupArrayImpl<GroupArrayTrait</* Thas_limit= */ true, Tlast, /* Tsampler= */ Sampler::NONE>>(argument_types[0], parameters, max_elems, std::nullopt);
|
||||
return createAggregateFunctionGroupArrayImpl<GroupArrayTrait</* Thas_limit= */ true, Tlast, /* Tsampler= */ Sampler::NONE>>(
|
||||
argument_types[0], parameters, max_elems, std::nullopt);
|
||||
}
|
||||
|
||||
AggregateFunctionPtr createAggregateFunctionGroupArraySample(
|
||||
|
@ -381,24 +381,23 @@ IAggregateFunction * createWithExtraTypes(const DataTypePtr & argument_type, con
|
||||
{
|
||||
WhichDataType which(argument_type);
|
||||
if (which.idx == TypeIndex::Date) return new AggregateFunctionGroupArrayIntersectDate(argument_type, parameters);
|
||||
else if (which.idx == TypeIndex::DateTime) return new AggregateFunctionGroupArrayIntersectDateTime(argument_type, parameters);
|
||||
else if (which.idx == TypeIndex::Date32) return new AggregateFunctionGroupArrayIntersectDate32(argument_type, parameters);
|
||||
else if (which.idx == TypeIndex::DateTime64)
|
||||
if (which.idx == TypeIndex::DateTime)
|
||||
return new AggregateFunctionGroupArrayIntersectDateTime(argument_type, parameters);
|
||||
if (which.idx == TypeIndex::Date32)
|
||||
return new AggregateFunctionGroupArrayIntersectDate32(argument_type, parameters);
|
||||
if (which.idx == TypeIndex::DateTime64)
|
||||
{
|
||||
const auto * datetime64_type = dynamic_cast<const DataTypeDateTime64 *>(argument_type.get());
|
||||
const auto return_type = std::make_shared<DataTypeArray>(std::make_shared<DataTypeDateTime64>(datetime64_type->getScale()));
|
||||
|
||||
return new AggregateFunctionGroupArrayIntersectGeneric<true>(argument_type, parameters, return_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/// Check that we can use plain version of AggregateFunctionGroupArrayIntersectGeneric
|
||||
if (argument_type->isValueUnambiguouslyRepresentedInContiguousMemoryRegion())
|
||||
return new AggregateFunctionGroupArrayIntersectGeneric<true>(argument_type, parameters);
|
||||
else
|
||||
return new AggregateFunctionGroupArrayIntersectGeneric<false>(argument_type, parameters);
|
||||
}
|
||||
}
|
||||
|
||||
inline AggregateFunctionPtr createAggregateFunctionGroupArrayIntersectImpl(const std::string & name, const DataTypePtr & argument_type, const Array & parameters)
|
||||
{
|
||||
|
@ -65,7 +65,6 @@ struct MovingSumData : public MovingData<T>
|
||||
{
|
||||
if (idx < window_size)
|
||||
return this->value[idx];
|
||||
else
|
||||
return this->value[idx] - this->value[idx - window_size];
|
||||
}
|
||||
};
|
||||
@ -79,7 +78,6 @@ struct MovingAvgData : public MovingData<T>
|
||||
{
|
||||
if (idx < window_size)
|
||||
return this->value[idx] / T(window_size);
|
||||
else
|
||||
return (this->value[idx] - this->value[idx - window_size]) / T(window_size);
|
||||
}
|
||||
};
|
||||
@ -285,17 +283,13 @@ AggregateFunctionPtr createAggregateFunctionMoving(
|
||||
{
|
||||
if (isDecimal(argument_type))
|
||||
return createAggregateFunctionMovingImpl<Function, std::false_type, std::true_type>(name, argument_type);
|
||||
else
|
||||
return createAggregateFunctionMovingImpl<Function, std::false_type, std::false_type>(name, argument_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (isDecimal(argument_type))
|
||||
return createAggregateFunctionMovingImpl<Function, std::true_type, std::true_type>(name, argument_type, max_elems);
|
||||
else
|
||||
return createAggregateFunctionMovingImpl<Function, std::true_type, std::false_type>(name, argument_type, max_elems);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -391,21 +391,20 @@ AggregateFunctionPtr createAggregateFunctionGroupArray(
|
||||
{
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Parameter for aggregate function {} should have limit argument", name);
|
||||
}
|
||||
else if (parameters.size() == 1)
|
||||
if (parameters.size() == 1)
|
||||
{
|
||||
auto type = parameters[0].getType();
|
||||
if (type != Field::Types::Int64 && type != Field::Types::UInt64)
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Parameter for aggregate function {} should be positive number", name);
|
||||
|
||||
if ((type == Field::Types::Int64 && parameters[0].safeGet<Int64>() < 0) ||
|
||||
(type == Field::Types::UInt64 && parameters[0].safeGet<UInt64>() == 0))
|
||||
if ((type == Field::Types::Int64 && parameters[0].safeGet<Int64>() < 0)
|
||||
|| (type == Field::Types::UInt64 && parameters[0].safeGet<UInt64>() == 0))
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Parameter for aggregate function {} should be positive number", name);
|
||||
|
||||
max_elems = parameters[0].safeGet<UInt64>();
|
||||
}
|
||||
else
|
||||
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
|
||||
"Function {} does not support this number of arguments", name);
|
||||
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Function {} does not support this number of arguments", name);
|
||||
|
||||
if (max_elems > group_array_sorted_sort_strategy_max_elements_threshold)
|
||||
return createAggregateFunctionGroupArraySortedImpl<GroupArraySortedSort>(argument_types[0], parameters, max_elems);
|
||||
|
@ -133,7 +133,6 @@ public:
|
||||
{
|
||||
if (revision >= STATE_VERSION_1_MIN_REVISION)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,6 @@ public:
|
||||
{
|
||||
if (isSmall())
|
||||
return small.size();
|
||||
else
|
||||
return roaring_bitmap->cardinality();
|
||||
}
|
||||
|
||||
@ -454,7 +453,6 @@ public:
|
||||
|
||||
if (isSmall())
|
||||
return small.find(static_cast<T>(x)) != small.end();
|
||||
else
|
||||
return roaring_bitmap->contains(static_cast<Value>(x));
|
||||
}
|
||||
|
||||
@ -554,8 +552,7 @@ public:
|
||||
r1.add(elem);
|
||||
return answer.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
UInt64 count = 0;
|
||||
for (auto it = roaring_bitmap->begin(); it != roaring_bitmap->end(); ++it)
|
||||
{
|
||||
@ -572,7 +569,6 @@ public:
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
UInt64 rb_offset_limit(UInt64 offset, UInt64 limit, RoaringBitmapWithSmallSet & r1) const /// NOLINT
|
||||
{
|
||||
@ -591,8 +587,7 @@ public:
|
||||
r1.add(it->getValue());
|
||||
return count;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
UInt64 count = 0;
|
||||
UInt64 offset_count = 0;
|
||||
auto it = roaring_bitmap->begin();
|
||||
@ -603,7 +598,6 @@ public:
|
||||
r1.add(*it);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
UInt64 rb_min() const /// NOLINT
|
||||
{
|
||||
@ -620,7 +614,6 @@ public:
|
||||
}
|
||||
return min_val;
|
||||
}
|
||||
else
|
||||
return roaring_bitmap->minimum();
|
||||
}
|
||||
|
||||
@ -639,7 +632,6 @@ public:
|
||||
}
|
||||
return max_val;
|
||||
}
|
||||
else
|
||||
return roaring_bitmap->maximum();
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,6 @@ AggregateFunctionPtr createAggregateFunctionGroupConcat(
|
||||
|
||||
if (has_limit)
|
||||
return std::make_shared<GroupConcatImpl</* has_limit= */ true>>(argument_types[0], parameters, limit, delimiter);
|
||||
else
|
||||
return std::make_shared<GroupConcatImpl</* has_limit= */ false>>(argument_types[0], parameters, limit, delimiter);
|
||||
}
|
||||
|
||||
|
@ -276,17 +276,16 @@ IAggregateFunction * createWithExtraTypes(const DataTypePtr & argument_type, TAr
|
||||
{
|
||||
WhichDataType which(argument_type);
|
||||
if (which.idx == TypeIndex::Date) return new AggregateFunctionGroupUniqArrayDate<HasLimit>(argument_type, args...);
|
||||
else if (which.idx == TypeIndex::DateTime) return new AggregateFunctionGroupUniqArrayDateTime<HasLimit>(argument_type, args...);
|
||||
else if (which.idx == TypeIndex::IPv4) return new AggregateFunctionGroupUniqArrayIPv4<HasLimit>(argument_type, args...);
|
||||
else
|
||||
{
|
||||
if (which.idx == TypeIndex::DateTime)
|
||||
return new AggregateFunctionGroupUniqArrayDateTime<HasLimit>(argument_type, args...);
|
||||
if (which.idx == TypeIndex::IPv4)
|
||||
return new AggregateFunctionGroupUniqArrayIPv4<HasLimit>(argument_type, args...);
|
||||
|
||||
/// Check that we can use plain version of AggregateFunctionGroupUniqArrayGeneric
|
||||
if (argument_type->isValueUnambiguouslyRepresentedInContiguousMemoryRegion())
|
||||
return new AggregateFunctionGroupUniqArrayGeneric<true, HasLimit>(argument_type, args...);
|
||||
else
|
||||
return new AggregateFunctionGroupUniqArrayGeneric<false, HasLimit>(argument_type, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename HasLimit, typename ... TArgs>
|
||||
inline AggregateFunctionPtr createAggregateFunctionGroupUniqArrayImpl(const std::string & name, const DataTypePtr & argument_type, TArgs ... args)
|
||||
@ -336,7 +335,6 @@ AggregateFunctionPtr createAggregateFunctionGroupUniqArray(
|
||||
|
||||
if (!limit_size)
|
||||
return createAggregateFunctionGroupUniqArrayImpl<std::false_type>(name, argument_types[0], parameters);
|
||||
else
|
||||
return createAggregateFunctionGroupUniqArrayImpl<std::true_type>(name, argument_types[0], parameters, max_elems);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,6 @@ public:
|
||||
{
|
||||
if (kind_ == AggregateFunctionIntersectionsKind::Count)
|
||||
return std::make_shared<DataTypeUInt64>();
|
||||
else
|
||||
return std::make_shared<DataTypeNumber<PointType>>();
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,9 @@ public:
|
||||
{
|
||||
if (other.count == 0)
|
||||
return;
|
||||
else if (count == 0)
|
||||
|
||||
/// NOLINTBEGIN(readability-else-after-return)
|
||||
if (count == 0)
|
||||
{
|
||||
compress_threshold = other.compress_threshold;
|
||||
relative_error = other.relative_error;
|
||||
@ -237,6 +239,7 @@ public:
|
||||
doCompress(2 * merged_relative_error * merged_count);
|
||||
compressed = true;
|
||||
}
|
||||
/// NOLINTEND(readability-else-after-return)
|
||||
}
|
||||
|
||||
void write(WriteBuffer & buf) const
|
||||
@ -292,13 +295,11 @@ private:
|
||||
Int64 max_rank = min_rank + curr_sample.delta;
|
||||
if (max_rank - target_error <= rank && rank <= min_rank + target_error)
|
||||
return {i, min_rank, curr_sample.value};
|
||||
else
|
||||
{
|
||||
|
||||
++i;
|
||||
curr_sample = sampled[i];
|
||||
min_rank += curr_sample.g;
|
||||
}
|
||||
}
|
||||
return {sampled.size() - 1, 0, sampled.back().value};
|
||||
}
|
||||
|
||||
|
@ -747,7 +747,7 @@ AggregateFunctionPtr createAggregateFunctionSequenceBase(
|
||||
WhichDataType which(argument_types.front().get());
|
||||
if (which.isDateTime())
|
||||
return std::make_shared<AggregateFunction<DataTypeDateTime::FieldType, Data<DataTypeDateTime::FieldType>>>(argument_types, params, pattern);
|
||||
else if (which.isDate())
|
||||
if (which.isDate())
|
||||
return std::make_shared<AggregateFunction<DataTypeDate::FieldType, Data<DataTypeDate::FieldType>>>(argument_types, params, pattern);
|
||||
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
|
@ -124,7 +124,6 @@ private:
|
||||
{
|
||||
if (count < 2)
|
||||
return std::numeric_limits<Float64>::infinity();
|
||||
else
|
||||
return m2 / (count - 1);
|
||||
}
|
||||
|
||||
@ -137,9 +136,8 @@ private:
|
||||
{
|
||||
if (count == 0)
|
||||
return std::numeric_limits<Float64>::infinity();
|
||||
else if (count == 1)
|
||||
if (count == 1)
|
||||
return 0.0;
|
||||
else
|
||||
return m2 / count;
|
||||
}
|
||||
|
||||
@ -363,7 +361,6 @@ private:
|
||||
{
|
||||
if (count < 2)
|
||||
return std::numeric_limits<Float64>::infinity();
|
||||
else
|
||||
return co_moment / (count - 1);
|
||||
}
|
||||
|
||||
@ -371,9 +368,8 @@ private:
|
||||
{
|
||||
if (count == 0)
|
||||
return std::numeric_limits<Float64>::infinity();
|
||||
else if (count == 1)
|
||||
if (count == 1)
|
||||
return 0.0;
|
||||
else
|
||||
return co_moment / count;
|
||||
}
|
||||
|
||||
@ -381,7 +377,6 @@ private:
|
||||
{
|
||||
if (count < 2)
|
||||
return std::numeric_limits<Float64>::infinity();
|
||||
else
|
||||
return co_moment / sqrt(left_m2 * right_m2);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,6 @@ public:
|
||||
{
|
||||
if (revision >= STATE_VERSION_1_MIN_REVISION)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -764,7 +763,6 @@ void registerAggregateFunctionSumMap(AggregateFunctionFactory & factory)
|
||||
auto [keys_type, values_types, tuple_argument] = parseArguments(name, arguments);
|
||||
if (tuple_argument)
|
||||
return std::make_shared<AggregateFunctionSumMap<false, true>>(keys_type, values_types, arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionSumMap<false, false>>(keys_type, values_types, arguments, params);
|
||||
});
|
||||
|
||||
@ -773,7 +771,6 @@ void registerAggregateFunctionSumMap(AggregateFunctionFactory & factory)
|
||||
auto [keys_type, values_types, tuple_argument] = parseArguments(name, arguments);
|
||||
if (tuple_argument)
|
||||
return std::make_shared<AggregateFunctionMinMap<true>>(keys_type, values_types, arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionMinMap<false>>(keys_type, values_types, arguments, params);
|
||||
});
|
||||
|
||||
@ -782,7 +779,6 @@ void registerAggregateFunctionSumMap(AggregateFunctionFactory & factory)
|
||||
auto [keys_type, values_types, tuple_argument] = parseArguments(name, arguments);
|
||||
if (tuple_argument)
|
||||
return std::make_shared<AggregateFunctionMaxMap<true>>(keys_type, values_types, arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionMaxMap<false>>(keys_type, values_types, arguments, params);
|
||||
});
|
||||
|
||||
@ -793,7 +789,6 @@ void registerAggregateFunctionSumMap(AggregateFunctionFactory & factory)
|
||||
auto [keys_type, values_types, tuple_argument] = parseArguments(name, arguments);
|
||||
if (tuple_argument)
|
||||
return std::make_shared<AggregateFunctionSumMap<true, true>>(keys_type, values_types, arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionSumMap<true, false>>(keys_type, values_types, arguments, params);
|
||||
});
|
||||
|
||||
@ -802,7 +797,6 @@ void registerAggregateFunctionSumMap(AggregateFunctionFactory & factory)
|
||||
auto [keys_type, values_types, tuple_argument] = parseArguments(name, arguments);
|
||||
if (tuple_argument)
|
||||
return std::make_shared<AggregateFunctionSumMapFiltered<false, true>>(keys_type, values_types, arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionSumMapFiltered<false, false>>(keys_type, values_types, arguments, params);
|
||||
});
|
||||
|
||||
@ -811,7 +805,6 @@ void registerAggregateFunctionSumMap(AggregateFunctionFactory & factory)
|
||||
auto [keys_type, values_types, tuple_argument] = parseArguments(name, arguments);
|
||||
if (tuple_argument)
|
||||
return std::make_shared<AggregateFunctionSumMapFiltered<true, true>>(keys_type, values_types, arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionSumMapFiltered<true, false>>(keys_type, values_types, arguments, params);
|
||||
});
|
||||
}
|
||||
|
@ -96,25 +96,18 @@ public:
|
||||
std::move(names)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
DataTypes types
|
||||
{
|
||||
|
||||
DataTypes types{
|
||||
std::make_shared<DataTypeNumber<Float64>>(),
|
||||
std::make_shared<DataTypeNumber<Float64>>(),
|
||||
};
|
||||
|
||||
Strings names
|
||||
{
|
||||
Strings names{
|
||||
"t_statistic",
|
||||
"p_value",
|
||||
};
|
||||
|
||||
return std::make_shared<DataTypeTuple>(
|
||||
std::move(types),
|
||||
std::move(names)
|
||||
);
|
||||
}
|
||||
return std::make_shared<DataTypeTuple>(std::move(types), std::move(names));
|
||||
}
|
||||
|
||||
bool allocatesMemoryInArena() const override { return false; }
|
||||
|
@ -79,7 +79,6 @@ public:
|
||||
{
|
||||
if (is_approx_top_k)
|
||||
return is_weighted ? "approx_top_sum" : "approx_top_k";
|
||||
else
|
||||
return is_weighted ? "topKWeighted" : "topK";
|
||||
}
|
||||
|
||||
@ -106,7 +105,6 @@ public:
|
||||
std::move(names)
|
||||
));
|
||||
}
|
||||
else
|
||||
return std::make_shared<DataTypeArray>(argument_types_[0]);
|
||||
}
|
||||
|
||||
@ -226,7 +224,6 @@ public:
|
||||
{
|
||||
if (is_approx_top_k)
|
||||
return is_weighted ? "approx_top_sum" : "approx_top_k";
|
||||
else
|
||||
return is_weighted ? "topKWeighted" : "topK";
|
||||
}
|
||||
|
||||
@ -253,10 +250,8 @@ public:
|
||||
std::move(names)
|
||||
));
|
||||
|
||||
} else
|
||||
{
|
||||
return std::make_shared<DataTypeArray>(argument_types_[0]);
|
||||
}
|
||||
return std::make_shared<DataTypeArray>(argument_types_[0]);
|
||||
}
|
||||
|
||||
bool allocatesMemoryInArena() const override
|
||||
@ -440,8 +435,8 @@ IAggregateFunction * createWithExtraTypes(const DataTypes & argument_types, UInt
|
||||
/// Check that we can use plain version of AggregateFunctionTopKGeneric
|
||||
if (argument_types[0]->isValueUnambiguouslyRepresentedInContiguousMemoryRegion())
|
||||
return new AggregateFunctionTopKGeneric<true, is_weighted>(threshold, reserved, include_counts, is_approx_top_k, argument_types, params);
|
||||
else
|
||||
return new AggregateFunctionTopKGeneric<false, is_weighted>(threshold, reserved, include_counts, is_approx_top_k, argument_types, params);
|
||||
return new AggregateFunctionTopKGeneric<false, is_weighted>(
|
||||
threshold, reserved, include_counts, is_approx_top_k, argument_types, params);
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,25 +54,24 @@ createAggregateFunctionUniq(const std::string & name, const DataTypes & argument
|
||||
WhichDataType which(argument_type);
|
||||
if (res)
|
||||
return res;
|
||||
else if (which.isDate())
|
||||
if (which.isDate())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeDate::FieldType, Data>>(argument_types);
|
||||
else if (which.isDate32())
|
||||
if (which.isDate32())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeDate32::FieldType, Data>>(argument_types);
|
||||
else if (which.isDateTime())
|
||||
if (which.isDateTime())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeDateTime::FieldType, Data>>(argument_types);
|
||||
else if (which.isStringOrFixedString())
|
||||
if (which.isStringOrFixedString())
|
||||
return std::make_shared<AggregateFunctionUniq<String, Data>>(argument_types);
|
||||
else if (which.isUUID())
|
||||
if (which.isUUID())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeUUID::FieldType, Data>>(argument_types);
|
||||
else if (which.isIPv4())
|
||||
if (which.isIPv4())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeIPv4::FieldType, Data>>(argument_types);
|
||||
else if (which.isIPv6())
|
||||
if (which.isIPv6())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeIPv6::FieldType, Data>>(argument_types);
|
||||
else if (which.isTuple())
|
||||
if (which.isTuple())
|
||||
{
|
||||
if (use_exact_hash_function)
|
||||
return std::make_shared<AggregateFunctionUniqVariadic<DataForVariadic<true, true>>>(argument_types);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionUniqVariadic<DataForVariadic<false, true>>>(argument_types);
|
||||
}
|
||||
}
|
||||
@ -80,7 +79,6 @@ createAggregateFunctionUniq(const std::string & name, const DataTypes & argument
|
||||
/// "Variadic" method also works as a fallback generic case for single argument.
|
||||
if (use_exact_hash_function)
|
||||
return std::make_shared<AggregateFunctionUniqVariadic<DataForVariadic<true, false>>>(argument_types);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionUniqVariadic<DataForVariadic<false, false>>>(argument_types);
|
||||
}
|
||||
|
||||
@ -107,33 +105,45 @@ createAggregateFunctionUniq(const std::string & name, const DataTypes & argument
|
||||
WhichDataType which(argument_type);
|
||||
if (res)
|
||||
return res;
|
||||
else if (which.isDate())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeDate::FieldType, Data<DataTypeDate::FieldType, is_able_to_parallelize_merge>>>(argument_types);
|
||||
else if (which.isDate32())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeDate32::FieldType, Data<DataTypeDate32::FieldType, is_able_to_parallelize_merge>>>(argument_types);
|
||||
else if (which.isDateTime())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeDateTime::FieldType, Data<DataTypeDateTime::FieldType, is_able_to_parallelize_merge>>>(argument_types);
|
||||
else if (which.isStringOrFixedString())
|
||||
if (which.isDate())
|
||||
return std::make_shared<
|
||||
AggregateFunctionUniq<DataTypeDate::FieldType, Data<DataTypeDate::FieldType, is_able_to_parallelize_merge>>>(
|
||||
argument_types);
|
||||
if (which.isDate32())
|
||||
return std::make_shared<
|
||||
AggregateFunctionUniq<DataTypeDate32::FieldType, Data<DataTypeDate32::FieldType, is_able_to_parallelize_merge>>>(
|
||||
argument_types);
|
||||
if (which.isDateTime())
|
||||
return std::make_shared<
|
||||
AggregateFunctionUniq<DataTypeDateTime::FieldType, Data<DataTypeDateTime::FieldType, is_able_to_parallelize_merge>>>(
|
||||
argument_types);
|
||||
if (which.isStringOrFixedString())
|
||||
return std::make_shared<AggregateFunctionUniq<String, Data<String, is_able_to_parallelize_merge>>>(argument_types);
|
||||
else if (which.isUUID())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeUUID::FieldType, Data<DataTypeUUID::FieldType, is_able_to_parallelize_merge>>>(argument_types);
|
||||
else if (which.isIPv4())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeIPv4::FieldType, Data<DataTypeIPv4::FieldType, is_able_to_parallelize_merge>>>(argument_types);
|
||||
else if (which.isIPv6())
|
||||
return std::make_shared<AggregateFunctionUniq<DataTypeIPv6::FieldType, Data<DataTypeIPv6::FieldType, is_able_to_parallelize_merge>>>(argument_types);
|
||||
else if (which.isTuple())
|
||||
if (which.isUUID())
|
||||
return std::make_shared<
|
||||
AggregateFunctionUniq<DataTypeUUID::FieldType, Data<DataTypeUUID::FieldType, is_able_to_parallelize_merge>>>(
|
||||
argument_types);
|
||||
if (which.isIPv4())
|
||||
return std::make_shared<
|
||||
AggregateFunctionUniq<DataTypeIPv4::FieldType, Data<DataTypeIPv4::FieldType, is_able_to_parallelize_merge>>>(
|
||||
argument_types);
|
||||
if (which.isIPv6())
|
||||
return std::make_shared<
|
||||
AggregateFunctionUniq<DataTypeIPv6::FieldType, Data<DataTypeIPv6::FieldType, is_able_to_parallelize_merge>>>(
|
||||
argument_types);
|
||||
if (which.isTuple())
|
||||
{
|
||||
if (use_exact_hash_function)
|
||||
return std::make_shared<AggregateFunctionUniqVariadic<DataForVariadic<true, true, is_able_to_parallelize_merge>>>(argument_types);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionUniqVariadic<DataForVariadic<false, true, is_able_to_parallelize_merge>>>(argument_types);
|
||||
return std::make_shared<AggregateFunctionUniqVariadic<DataForVariadic<true, true, is_able_to_parallelize_merge>>>(
|
||||
argument_types);
|
||||
return std::make_shared<AggregateFunctionUniqVariadic<DataForVariadic<false, true, is_able_to_parallelize_merge>>>(
|
||||
argument_types);
|
||||
}
|
||||
}
|
||||
|
||||
/// "Variadic" method also works as a fallback generic case for single argument.
|
||||
if (use_exact_hash_function)
|
||||
return std::make_shared<AggregateFunctionUniqVariadic<DataForVariadic<true, false, is_able_to_parallelize_merge>>>(argument_types);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionUniqVariadic<DataForVariadic<false, false, is_able_to_parallelize_merge>>>(argument_types);
|
||||
}
|
||||
|
||||
@ -155,9 +165,11 @@ void registerAggregateFunctionsUniq(AggregateFunctionFactory & factory)
|
||||
if (settings && (*settings)[Setting::max_threads] > 1)
|
||||
return createAggregateFunctionUniq<
|
||||
true, AggregateFunctionUniqExactData, AggregateFunctionUniqExactDataForVariadic, true /* is_able_to_parallelize_merge */>(name, argument_types, params, settings);
|
||||
else
|
||||
return createAggregateFunctionUniq<
|
||||
true, AggregateFunctionUniqExactData, AggregateFunctionUniqExactDataForVariadic, false /* is_able_to_parallelize_merge */>(name, argument_types, params, settings);
|
||||
true,
|
||||
AggregateFunctionUniqExactData,
|
||||
AggregateFunctionUniqExactDataForVariadic,
|
||||
false /* is_able_to_parallelize_merge */>(name, argument_types, params, settings);
|
||||
};
|
||||
factory.registerFunction("uniqExact", {assign_bool_param, properties});
|
||||
|
||||
|
@ -235,33 +235,39 @@ AggregateFunctionPtr createAggregateFunctionWithK(const DataTypes & argument_typ
|
||||
WhichDataType which(argument_type);
|
||||
if (res)
|
||||
return res;
|
||||
else if (which.isDate())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeDate::FieldType>>(argument_types, params);
|
||||
else if (which.isDate32())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeDate32::FieldType>>(argument_types, params);
|
||||
else if (which.isDateTime())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeDateTime::FieldType>>(argument_types, params);
|
||||
else if (which.isStringOrFixedString())
|
||||
if (which.isDate())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeDate::FieldType>>(
|
||||
argument_types, params);
|
||||
if (which.isDate32())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeDate32::FieldType>>(
|
||||
argument_types, params);
|
||||
if (which.isDateTime())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeDateTime::FieldType>>(
|
||||
argument_types, params);
|
||||
if (which.isStringOrFixedString())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<String>>(argument_types, params);
|
||||
else if (which.isUUID())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeUUID::FieldType>>(argument_types, params);
|
||||
else if (which.isIPv4())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeIPv4::FieldType>>(argument_types, params);
|
||||
else if (which.isIPv6())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeIPv6::FieldType>>(argument_types, params);
|
||||
else if (which.isTuple())
|
||||
if (which.isUUID())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeUUID::FieldType>>(
|
||||
argument_types, params);
|
||||
if (which.isIPv4())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeIPv4::FieldType>>(
|
||||
argument_types, params);
|
||||
if (which.isIPv6())
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunction<DataTypeIPv6::FieldType>>(
|
||||
argument_types, params);
|
||||
if (which.isTuple())
|
||||
{
|
||||
if (use_exact_hash_function)
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunctionVariadic<true, true>>(argument_types, params);
|
||||
else
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunctionVariadic<false, true>>(argument_types, params);
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunctionVariadic<true, true>>(
|
||||
argument_types, params);
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunctionVariadic<false, true>>(
|
||||
argument_types, params);
|
||||
}
|
||||
}
|
||||
|
||||
/// "Variadic" method also works as a fallback generic case for a single argument.
|
||||
if (use_exact_hash_function)
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunctionVariadic<true, false>>(argument_types, params);
|
||||
else
|
||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunctionVariadic<false, false>>(argument_types, params);
|
||||
}
|
||||
|
||||
@ -270,7 +276,6 @@ AggregateFunctionPtr createAggregateFunctionWithHashType(bool use_64_bit_hash, c
|
||||
{
|
||||
if (use_64_bit_hash)
|
||||
return createAggregateFunctionWithK<K, UInt64>(argument_types, params);
|
||||
else
|
||||
return createAggregateFunctionWithK<K, UInt32>(argument_types, params);
|
||||
}
|
||||
|
||||
|
@ -324,21 +324,20 @@ AggregateFunctionPtr createAggregateFunctionUniqUpTo(const std::string & name, c
|
||||
WhichDataType which(argument_type);
|
||||
if (res)
|
||||
return res;
|
||||
else if (which.isDate())
|
||||
if (which.isDate())
|
||||
return std::make_shared<AggregateFunctionUniqUpTo<DataTypeDate::FieldType>>(threshold, argument_types, params);
|
||||
else if (which.isDate32())
|
||||
if (which.isDate32())
|
||||
return std::make_shared<AggregateFunctionUniqUpTo<DataTypeDate32::FieldType>>(threshold, argument_types, params);
|
||||
else if (which.isDateTime())
|
||||
if (which.isDateTime())
|
||||
return std::make_shared<AggregateFunctionUniqUpTo<DataTypeDateTime::FieldType>>(threshold, argument_types, params);
|
||||
else if (which.isStringOrFixedString())
|
||||
if (which.isStringOrFixedString())
|
||||
return std::make_shared<AggregateFunctionUniqUpTo<String>>(threshold, argument_types, params);
|
||||
else if (which.isUUID())
|
||||
if (which.isUUID())
|
||||
return std::make_shared<AggregateFunctionUniqUpTo<DataTypeUUID::FieldType>>(threshold, argument_types, params);
|
||||
else if (which.isTuple())
|
||||
if (which.isTuple())
|
||||
{
|
||||
if (use_exact_hash_function)
|
||||
return std::make_shared<AggregateFunctionUniqUpToVariadic<true, true>>(argument_types, params, threshold);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionUniqUpToVariadic<false, true>>(argument_types, params, threshold);
|
||||
}
|
||||
}
|
||||
@ -346,7 +345,6 @@ AggregateFunctionPtr createAggregateFunctionUniqUpTo(const std::string & name, c
|
||||
/// "Variadic" method also works as a fallback generic case for single argument.
|
||||
if (use_exact_hash_function)
|
||||
return std::make_shared<AggregateFunctionUniqUpToVariadic<true, false>>(argument_types, params, threshold);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionUniqUpToVariadic<false, false>>(argument_types, params, threshold);
|
||||
}
|
||||
|
||||
|
@ -180,10 +180,9 @@ private:
|
||||
{
|
||||
if (first_event)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else if (event_idx == 0)
|
||||
if (event_idx == 0)
|
||||
{
|
||||
events_timestamp[0] = std::make_pair(timestamp, timestamp);
|
||||
first_event = true;
|
||||
@ -326,10 +325,11 @@ createAggregateFunctionWindowFunnel(const std::string & name, const DataTypes &
|
||||
WhichDataType which(arguments.front().get());
|
||||
if (res)
|
||||
return res;
|
||||
else if (which.isDate())
|
||||
if (which.isDate())
|
||||
return std::make_shared<AggregateFunctionWindowFunnel<DataTypeDate::FieldType, Data<DataTypeDate::FieldType>>>(arguments, params);
|
||||
else if (which.isDateTime())
|
||||
return std::make_shared<AggregateFunctionWindowFunnel<DataTypeDateTime::FieldType, Data<DataTypeDateTime::FieldType>>>(arguments, params);
|
||||
if (which.isDateTime())
|
||||
return std::make_shared<AggregateFunctionWindowFunnel<DataTypeDateTime::FieldType, Data<DataTypeDateTime::FieldType>>>(
|
||||
arguments, params);
|
||||
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of first argument of aggregate function {}, must "
|
||||
|
@ -50,10 +50,8 @@ public:
|
||||
return std::make_shared<
|
||||
AggregateFunctionDistinct<
|
||||
AggregateFunctionDistinctSingleGenericData<true>>>(nested_function, arguments, params);
|
||||
else
|
||||
return std::make_shared<
|
||||
AggregateFunctionDistinct<
|
||||
AggregateFunctionDistinctSingleGenericData<false>>>(nested_function, arguments, params);
|
||||
return std::make_shared<AggregateFunctionDistinct<AggregateFunctionDistinctSingleGenericData<false>>>(
|
||||
nested_function, arguments, params);
|
||||
}
|
||||
|
||||
return std::make_shared<AggregateFunctionDistinct<AggregateFunctionDistinctMultipleGenericData>>(nested_function, arguments, params);
|
||||
|
@ -473,29 +473,21 @@ AggregateFunctionPtr AggregateFunctionIf::getOwnNullAdapter(
|
||||
{
|
||||
return std::make_shared<AggregateFunctionIfNullUnary<true, true>>(nested_function->getName(), nested_func, arguments, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (need_to_serialize_flag)
|
||||
return std::make_shared<AggregateFunctionIfNullUnary<false, true>>(nested_function->getName(), nested_func, arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionIfNullUnary<false, false>>(nested_function->getName(), nested_func, arguments, params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (return_type_is_nullable)
|
||||
{
|
||||
return std::make_shared<AggregateFunctionIfNullVariadic<true, true>>(nested_function, arguments, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (need_to_serialize_flag)
|
||||
return std::make_shared<AggregateFunctionIfNullVariadic<false, true>>(nested_function, arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionIfNullVariadic<false, false>>(nested_function, arguments, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void registerAggregateFunctionCombinatorIf(AggregateFunctionCombinatorFactory & factory)
|
||||
{
|
||||
|
@ -450,9 +450,8 @@ public:
|
||||
auto action = NullsAction::EMPTY;
|
||||
return aggr_func_factory.get(nested_func_name + "MappedArrays", action, arguments, params, out_properties);
|
||||
}
|
||||
else
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Aggregation '{}Map' is not implemented for mapped arrays",
|
||||
nested_func_name);
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Aggregation '{}Map' is not implemented for mapped arrays", nested_func_name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -112,7 +112,6 @@ public:
|
||||
*/
|
||||
if (properties.returns_default_when_only_null)
|
||||
return std::make_shared<AggregateFunctionNothingUInt64>(arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionNothingNull>(arguments, params);
|
||||
}
|
||||
|
||||
@ -137,22 +136,17 @@ public:
|
||||
{
|
||||
return std::make_shared<AggregateFunctionNullUnary<true, true>>(nested_function, arguments, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (serialize_flag)
|
||||
return std::make_shared<AggregateFunctionNullUnary<false, true>>(nested_function, arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionNullUnary<false, false>>(nested_function, arguments, params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (return_type_is_nullable)
|
||||
{
|
||||
return std::make_shared<AggregateFunctionNullVariadic<true, true>>(nested_function, arguments, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return std::make_shared<AggregateFunctionNullVariadic<false, true>>(nested_function, arguments, params);
|
||||
#if 0
|
||||
if (serialize_flag)
|
||||
@ -165,8 +159,6 @@ public:
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ public:
|
||||
{
|
||||
if (kind == Kind::OrNull)
|
||||
return std::make_shared<AggregateFunctionOrFill<true>>(nested_function, arguments, params);
|
||||
else
|
||||
return std::make_shared<AggregateFunctionOrFill<false>>(nested_function, arguments, params);
|
||||
}
|
||||
};
|
||||
|
@ -120,12 +120,10 @@ public:
|
||||
this->merge(new_sketch);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
DDSketchDenseLogarithmic new_sketch = changeMapping(other.mapping->getGamma());
|
||||
copy(new_sketch);
|
||||
}
|
||||
}
|
||||
|
||||
// If the other sketch is empty, do nothing
|
||||
if (other.count == 0)
|
||||
|
@ -694,7 +694,7 @@ class IAggregateFunctionDataHelper : public IAggregateFunctionHelper<Derived>
|
||||
protected:
|
||||
using Data = T;
|
||||
|
||||
static Data & data(AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); }
|
||||
static Data & data(const AggregateDataPtr __restrict place) { return *reinterpret_cast<Data *>(place); }
|
||||
static const Data & data(ConstAggregateDataPtr __restrict place) { return *reinterpret_cast<const Data *>(place); }
|
||||
|
||||
public:
|
||||
|
@ -146,7 +146,7 @@ struct QuantileExactExclusive : public QuantileExact<Value>
|
||||
|
||||
if (n >= array.size())
|
||||
return static_cast<Float64>(*std::max_element(array.begin(), array.end()));
|
||||
else if (n < 1)
|
||||
if (n < 1)
|
||||
return static_cast<Float64>(*std::min_element(array.begin(), array.end()));
|
||||
|
||||
::nth_element(array.begin(), array.begin() + n - 1, array.end());
|
||||
@ -211,7 +211,7 @@ struct QuantileExactInclusive : public QuantileExact<Value>
|
||||
|
||||
if (n >= array.size())
|
||||
return static_cast<Float64>(*std::max_element(array.begin(), array.end()));
|
||||
else if (n < 1)
|
||||
if (n < 1)
|
||||
return static_cast<Float64>(*std::min_element(array.begin(), array.end()));
|
||||
::nth_element(array.begin(), array.begin() + n - 1, array.end());
|
||||
auto * nth_elem = std::min_element(array.begin() + n, array.end());
|
||||
|
@ -416,15 +416,10 @@ public:
|
||||
|
||||
if (x <= left)
|
||||
return checkOverflow<ResultType>(prev_mean);
|
||||
else if (x >= right)
|
||||
if (x >= right)
|
||||
return checkOverflow<ResultType>(c.mean);
|
||||
else
|
||||
return checkOverflow<ResultType>(interpolate(
|
||||
static_cast<Value>(x),
|
||||
static_cast<Value>(left),
|
||||
prev_mean,
|
||||
static_cast<Value>(right),
|
||||
c.mean));
|
||||
return checkOverflow<ResultType>(
|
||||
interpolate(static_cast<Value>(x), static_cast<Value>(left), prev_mean, static_cast<Value>(right), c.mean));
|
||||
}
|
||||
|
||||
sum += c.count;
|
||||
|
@ -736,15 +736,13 @@ public:
|
||||
tiny.prepare();
|
||||
return tiny.get(level);
|
||||
}
|
||||
else if (kind == Kind::Medium)
|
||||
if (kind == Kind::Medium)
|
||||
{
|
||||
return medium.get(level);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return large->get(level);
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the size values of the quantiles of the `levels` levels. Record `size` results starting with `result` address.
|
||||
template <typename ResultType>
|
||||
|
@ -260,7 +260,6 @@ private:
|
||||
/// With a large number of values, we will generate random numbers several times slower.
|
||||
if (limit <= static_cast<UInt64>(pcg32_fast::max()))
|
||||
return rng() % limit;
|
||||
else
|
||||
return (static_cast<UInt64>(rng()) * (static_cast<UInt64>(pcg32_fast::max()) + 1ULL) + static_cast<UInt64>(rng())) % limit;
|
||||
}
|
||||
|
||||
@ -277,7 +276,6 @@ private:
|
||||
{
|
||||
if (OnEmpty == ReservoirSamplerOnEmpty::THROW)
|
||||
throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "Quantile of empty ReservoirSampler");
|
||||
else
|
||||
return NanLikeValueConstructor<ResultType, std::is_floating_point_v<ResultType>>::getValue();
|
||||
}
|
||||
};
|
||||
|
@ -271,7 +271,6 @@ private:
|
||||
{
|
||||
if (OnEmpty == ReservoirSamplerDeterministicOnEmpty::THROW)
|
||||
throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "Quantile of empty ReservoirSamplerDeterministic");
|
||||
else
|
||||
return NanLikeValueConstructor<ResultType, std::is_floating_point_v<ResultType>>::getValue();
|
||||
}
|
||||
};
|
||||
|
@ -50,8 +50,7 @@ std::optional<size_t> SingleValueDataBase::getSmallestIndex(const IColumn & colu
|
||||
index = i;
|
||||
return {index};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
constexpr IColumn::PermutationSortDirection direction = IColumn::PermutationSortDirection::Ascending;
|
||||
constexpr IColumn::PermutationSortStability stability = IColumn::PermutationSortStability::Unstable;
|
||||
IColumn::Permutation permutation;
|
||||
@ -59,7 +58,6 @@ std::optional<size_t> SingleValueDataBase::getSmallestIndex(const IColumn & colu
|
||||
column.getPermutation(direction, stability, limit, nan_null_direction_hint, permutation);
|
||||
return {permutation[0]};
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<size_t> SingleValueDataBase::getGreatestIndex(const IColumn & column, size_t row_begin, size_t row_end) const
|
||||
{
|
||||
@ -77,8 +75,7 @@ std::optional<size_t> SingleValueDataBase::getGreatestIndex(const IColumn & colu
|
||||
index = i;
|
||||
return {index};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
constexpr IColumn::PermutationSortDirection direction = IColumn::PermutationSortDirection::Descending;
|
||||
constexpr IColumn::PermutationSortStability stability = IColumn::PermutationSortStability::Unstable;
|
||||
IColumn::Permutation permutation;
|
||||
@ -86,7 +83,6 @@ std::optional<size_t> SingleValueDataBase::getGreatestIndex(const IColumn & colu
|
||||
column.getPermutation(direction, stability, limit, nan_null_direction_hint, permutation);
|
||||
return {permutation[0]};
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<size_t> SingleValueDataBase::getSmallestIndexNotNullIf(
|
||||
const IColumn & column, const UInt8 * __restrict null_map, const UInt8 * __restrict if_map, size_t row_begin, size_t row_end) const
|
||||
@ -247,7 +243,6 @@ bool SingleValueDataFixed<T>::setIfSmaller(const SingleValueDataFixed<T> & to, A
|
||||
set(to, arena);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -259,7 +254,6 @@ bool SingleValueDataFixed<T>::setIfGreater(const SingleValueDataFixed<T> & to, A
|
||||
set(to, arena);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -271,7 +265,6 @@ bool SingleValueDataFixed<T>::setIfSmaller(const IColumn & column, size_t row_nu
|
||||
set(column, row_num, arena);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -283,7 +276,6 @@ bool SingleValueDataFixed<T>::setIfGreater(const IColumn & column, size_t row_nu
|
||||
set(column, row_num, arena);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -544,7 +536,7 @@ std::optional<size_t> SingleValueDataFixed<T>::getGreatestIndexNotNullIf(
|
||||
}
|
||||
return opt;
|
||||
}
|
||||
else if (!null_map)
|
||||
if (!null_map)
|
||||
{
|
||||
opt = findExtremeMaxIf(vec.getData().data(), if_map, row_begin, row_end);
|
||||
if (!opt.has_value())
|
||||
@ -556,8 +548,7 @@ std::optional<size_t> SingleValueDataFixed<T>::getGreatestIndexNotNullIf(
|
||||
}
|
||||
return opt;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
auto final_flags = mergeIfAndNullFlags(null_map, if_map, row_begin, row_end);
|
||||
opt = findExtremeMaxIf(vec.getData().data(), final_flags.get(), row_begin, row_end);
|
||||
if (!opt.has_value())
|
||||
@ -567,7 +558,7 @@ std::optional<size_t> SingleValueDataFixed<T>::getGreatestIndexNotNullIf(
|
||||
if (final_flags[i] && vec[i] == *opt)
|
||||
return {i};
|
||||
}
|
||||
}
|
||||
|
||||
UNREACHABLE();
|
||||
}
|
||||
else
|
||||
@ -1218,7 +1209,6 @@ bool SingleValueDataString::setIfSmaller(const IColumn & column, size_t row_num,
|
||||
set(column, row_num, arena);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1230,7 +1220,6 @@ bool SingleValueDataString::setIfSmaller(const SingleValueDataBase & other, Aren
|
||||
changeImpl(to.getStringRef(), arena);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1243,7 +1232,6 @@ bool SingleValueDataString::setIfGreater(const IColumn & column, size_t row_num,
|
||||
set(column, row_num, arena);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1255,7 +1243,6 @@ bool SingleValueDataString::setIfGreater(const SingleValueDataBase & other, Aren
|
||||
changeImpl(to.getStringRef(), arena);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1317,8 +1304,7 @@ bool SingleValueDataGeneric::setIfSmaller(const IColumn & column, size_t row_num
|
||||
set(column, row_num, arena);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Field new_value;
|
||||
column.get(row_num, new_value);
|
||||
if (new_value < value)
|
||||
@ -1326,10 +1312,8 @@ bool SingleValueDataGeneric::setIfSmaller(const IColumn & column, size_t row_num
|
||||
value = new_value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SingleValueDataGeneric::setIfSmaller(const SingleValueDataBase & other, Arena *)
|
||||
{
|
||||
@ -1339,7 +1323,6 @@ bool SingleValueDataGeneric::setIfSmaller(const SingleValueDataBase & other, Are
|
||||
value = to.value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1350,8 +1333,7 @@ bool SingleValueDataGeneric::setIfGreater(const IColumn & column, size_t row_num
|
||||
set(column, row_num, arena);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Field new_value;
|
||||
column.get(row_num, new_value);
|
||||
if (new_value > value)
|
||||
@ -1359,10 +1341,8 @@ bool SingleValueDataGeneric::setIfGreater(const IColumn & column, size_t row_num
|
||||
value = new_value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SingleValueDataGeneric::setIfGreater(const SingleValueDataBase & other, Arena *)
|
||||
{
|
||||
@ -1372,7 +1352,6 @@ bool SingleValueDataGeneric::setIfGreater(const SingleValueDataBase & other, Are
|
||||
value = to.value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -60,9 +60,8 @@ public:
|
||||
{
|
||||
if (sk_union)
|
||||
return static_cast<UInt64>(sk_union->get_result().get_estimate());
|
||||
else if (sk_update)
|
||||
if (sk_update)
|
||||
return static_cast<UInt64>(sk_update->get_estimate());
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ bool isAllArgumentsContiguousInMemory(const DataTypes & argument_types)
|
||||
|
||||
if (single_argument_as_tuple)
|
||||
return check_all_arguments_are_contiguous_in_memory(single_argument_as_tuple->getElements());
|
||||
else
|
||||
return check_all_arguments_are_contiguous_in_memory(argument_types);
|
||||
}
|
||||
|
||||
|
@ -163,8 +163,7 @@ void ExceptColumnTransformerNode::dumpTreeImpl(WriteBuffer & buffer, FormatState
|
||||
buffer << ", pattern: " << column_matcher->pattern();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
buffer << ", identifiers: ";
|
||||
|
||||
size_t except_column_names_size = except_column_names.size();
|
||||
@ -176,7 +175,6 @@ void ExceptColumnTransformerNode::dumpTreeImpl(WriteBuffer & buffer, FormatState
|
||||
buffer << ", ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ExceptColumnTransformerNode::isEqualImpl(const IQueryTreeNode & rhs, CompareOptions) const
|
||||
{
|
||||
@ -190,9 +188,9 @@ bool ExceptColumnTransformerNode::isEqualImpl(const IQueryTreeNode & rhs, Compar
|
||||
|
||||
if (!column_matcher && !rhs_column_matcher)
|
||||
return true;
|
||||
else if (column_matcher && !rhs_column_matcher)
|
||||
if (column_matcher && !rhs_column_matcher)
|
||||
return false;
|
||||
else if (!column_matcher && rhs_column_matcher)
|
||||
if (!column_matcher && rhs_column_matcher)
|
||||
return false;
|
||||
|
||||
return column_matcher->pattern() == rhs_column_matcher->pattern();
|
||||
|
@ -173,9 +173,9 @@ bool FunctionNode::isEqualImpl(const IQueryTreeNode & rhs, CompareOptions compar
|
||||
|
||||
if (lhs_result_type && rhs_result_type && !lhs_result_type->equals(*rhs_result_type))
|
||||
return false;
|
||||
else if (lhs_result_type && !rhs_result_type)
|
||||
if (lhs_result_type && !rhs_result_type)
|
||||
return false;
|
||||
else if (!lhs_result_type && rhs_result_type)
|
||||
if (!lhs_result_type && rhs_result_type)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -127,9 +127,9 @@ bool IQueryTreeNode::isEqual(const IQueryTreeNode & rhs, CompareOptions compare_
|
||||
|
||||
if (!lhs_child && !rhs_child)
|
||||
continue;
|
||||
else if (lhs_child && !rhs_child)
|
||||
if (lhs_child && !rhs_child)
|
||||
return false;
|
||||
else if (!lhs_child && rhs_child)
|
||||
if (!lhs_child && rhs_child)
|
||||
return false;
|
||||
|
||||
nodes_to_process.emplace_back(lhs_child.get(), rhs_child.get());
|
||||
@ -150,9 +150,9 @@ bool IQueryTreeNode::isEqual(const IQueryTreeNode & rhs, CompareOptions compare_
|
||||
|
||||
if (!lhs_strong_pointer && !rhs_strong_pointer)
|
||||
continue;
|
||||
else if (lhs_strong_pointer && !rhs_strong_pointer)
|
||||
if (lhs_strong_pointer && !rhs_strong_pointer)
|
||||
return false;
|
||||
else if (!lhs_strong_pointer && rhs_strong_pointer)
|
||||
if (!lhs_strong_pointer && rhs_strong_pointer)
|
||||
return false;
|
||||
|
||||
nodes_to_process.emplace_back(lhs_strong_pointer.get(), rhs_strong_pointer.get());
|
||||
|
@ -202,7 +202,6 @@ private:
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
visit(child);
|
||||
}
|
||||
|
||||
|
@ -173,9 +173,9 @@ bool MatcherNode::isEqualImpl(const IQueryTreeNode & rhs, CompareOptions) const
|
||||
|
||||
if (!columns_matcher && !rhs_columns_matcher)
|
||||
return true;
|
||||
else if (columns_matcher && !rhs_columns_matcher)
|
||||
if (columns_matcher && !rhs_columns_matcher)
|
||||
return false;
|
||||
else if (!columns_matcher && rhs_columns_matcher)
|
||||
if (!columns_matcher && rhs_columns_matcher)
|
||||
return false;
|
||||
|
||||
return columns_matcher->pattern() == rhs_columns_matcher->pattern();
|
||||
|
@ -118,9 +118,8 @@ public:
|
||||
{
|
||||
if (aggregate_function_name == "min")
|
||||
return "max";
|
||||
else if (aggregate_function_name == "max")
|
||||
if (aggregate_function_name == "max")
|
||||
return "min";
|
||||
else
|
||||
return aggregate_function_name;
|
||||
};
|
||||
|
||||
|
@ -486,7 +486,6 @@ CNF & CNF::reduce()
|
||||
statements = filterCNFSubsets(statements);
|
||||
return *this;
|
||||
}
|
||||
else
|
||||
statements = new_statements;
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ StorageSnapshotPtr getStorageSnapshot(const QueryTreeNodePtr & node)
|
||||
StorageSnapshotPtr storage_snapshot{nullptr};
|
||||
if (auto * table_node = node->as<TableNode>())
|
||||
return table_node->getStorageSnapshot();
|
||||
else if (auto * table_function_node = node->as<TableFunctionNode>())
|
||||
if (auto * table_function_node = node->as<TableFunctionNode>())
|
||||
return table_function_node->getStorageSnapshot();
|
||||
|
||||
return nullptr;
|
||||
|
@ -43,7 +43,6 @@ DataTypePtr getEnumType(const std::set<std::string> & string_values)
|
||||
{
|
||||
if (string_values.size() >= 255)
|
||||
return getDataEnumType<DataTypeEnum16>(string_values);
|
||||
else
|
||||
return getDataEnumType<DataTypeEnum8>(string_values);
|
||||
}
|
||||
|
||||
|
@ -165,27 +165,26 @@ private:
|
||||
createFunctionNode("greaterOrEquals", column_node, std::make_shared<ConstantNode>(start_date_or_date_time)),
|
||||
createFunctionNode("less", column_node, std::make_shared<ConstantNode>(end_date_or_date_time)));
|
||||
}
|
||||
else if (comparator == "notEquals")
|
||||
if (comparator == "notEquals")
|
||||
{
|
||||
return createFunctionNode(
|
||||
"or",
|
||||
createFunctionNode("less", column_node, std::make_shared<ConstantNode>(start_date_or_date_time)),
|
||||
createFunctionNode("greaterOrEquals", column_node, std::make_shared<ConstantNode>(end_date_or_date_time)));
|
||||
}
|
||||
else if (comparator == "greater")
|
||||
if (comparator == "greater")
|
||||
{
|
||||
return createFunctionNode("greaterOrEquals", column_node, std::make_shared<ConstantNode>(end_date_or_date_time));
|
||||
}
|
||||
else if (comparator == "lessOrEquals")
|
||||
if (comparator == "lessOrEquals")
|
||||
{
|
||||
return createFunctionNode("less", column_node, std::make_shared<ConstantNode>(end_date_or_date_time));
|
||||
}
|
||||
else if (comparator == "less" || comparator == "greaterOrEquals")
|
||||
if (comparator == "less" || comparator == "greaterOrEquals")
|
||||
{
|
||||
return createFunctionNode(comparator, column_node, std::make_shared<ConstantNode>(start_date_or_date_time));
|
||||
}
|
||||
else [[unlikely]]
|
||||
{
|
||||
[[unlikely]] {
|
||||
throw Exception(
|
||||
ErrorCodes::LOGICAL_ERROR,
|
||||
"Expected equals, notEquals, less, lessOrEquals, greater, greaterOrEquals. Actual {}",
|
||||
|
@ -552,9 +552,9 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromExpressionArguments
|
||||
auto node_type = it->second->getNodeType();
|
||||
if (identifier_lookup.isExpressionLookup() && !isExpressionNodeType(node_type))
|
||||
return {};
|
||||
else if (identifier_lookup.isTableExpressionLookup() && !isTableExpressionNodeType(node_type))
|
||||
if (identifier_lookup.isTableExpressionLookup() && !isTableExpressionNodeType(node_type))
|
||||
return {};
|
||||
else if (identifier_lookup.isFunctionLookup() && !isFunctionExpressionNodeType(node_type))
|
||||
if (identifier_lookup.isFunctionLookup() && !isFunctionExpressionNodeType(node_type))
|
||||
return {};
|
||||
|
||||
if (!resolve_full_identifier && identifier_lookup.identifier.isCompound() && identifier_lookup.isExpressionLookup())
|
||||
@ -638,9 +638,8 @@ bool IdentifierResolver::tryBindIdentifierToTableExpression(const IdentifierLook
|
||||
|
||||
if (parts_size == 1 && path_start == table_name)
|
||||
return true;
|
||||
else if (parts_size == 2 && path_start == database_name && identifier[1] == table_name)
|
||||
if (parts_size == 2 && path_start == database_name && identifier[1] == table_name)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -910,9 +909,8 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromTableExpression(con
|
||||
|
||||
if (parts_size == 1 && path_start == table_name)
|
||||
return table_expression_node;
|
||||
else if (parts_size == 2 && path_start == database_name && identifier[1] == table_name)
|
||||
if (parts_size == 2 && path_start == database_name && identifier[1] == table_name)
|
||||
return table_expression_node;
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -1219,9 +1219,10 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const Identifier
|
||||
scope,
|
||||
identifier_resolve_settings.allow_to_check_join_tree /* can_be_not_found */);
|
||||
}
|
||||
else if (identifier_lookup.isFunctionLookup() || identifier_lookup.isTableExpressionLookup())
|
||||
if (identifier_lookup.isFunctionLookup() || identifier_lookup.isTableExpressionLookup())
|
||||
{
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS,
|
||||
throw Exception(
|
||||
ErrorCodes::BAD_ARGUMENTS,
|
||||
"Compound identifier '{}' cannot be resolved as {}. In scope {}",
|
||||
identifier_lookup.identifier.getFullName(),
|
||||
identifier_lookup.isFunctionLookup() ? "function" : "table expression",
|
||||
@ -1307,7 +1308,7 @@ IdentifierResolveResult QueryAnalyzer::tryResolveIdentifierInParentScopes(const
|
||||
{
|
||||
return lookup_result;
|
||||
}
|
||||
else if (auto * resolved_function = resolved_identifier->as<FunctionNode>())
|
||||
if (auto * resolved_function = resolved_identifier->as<FunctionNode>())
|
||||
{
|
||||
/// Special case: scalar subquery was executed and replaced by __getScalar function.
|
||||
/// Handle it as a constant.
|
||||
@ -3173,14 +3174,14 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
|
||||
node = std::move(result_list);
|
||||
return result_projection_names;
|
||||
}
|
||||
else if (function_name == "grouping")
|
||||
if (function_name == "grouping")
|
||||
{
|
||||
/// It is responsibility of planner to perform additional handling of grouping function
|
||||
if (function_arguments_size == 0)
|
||||
throw Exception(ErrorCodes::TOO_FEW_ARGUMENTS_FOR_FUNCTION,
|
||||
"Function GROUPING expects at least one argument");
|
||||
else if (function_arguments_size > 64)
|
||||
throw Exception(ErrorCodes::TOO_MANY_ARGUMENTS_FOR_FUNCTION,
|
||||
throw Exception(ErrorCodes::TOO_FEW_ARGUMENTS_FOR_FUNCTION, "Function GROUPING expects at least one argument");
|
||||
if (function_arguments_size > 64)
|
||||
throw Exception(
|
||||
ErrorCodes::TOO_MANY_ARGUMENTS_FOR_FUNCTION,
|
||||
"Function GROUPING can have up to 64 arguments, but {} provided",
|
||||
function_arguments_size);
|
||||
checkFunctionNodeHasEmptyNullsAction(function_node);
|
||||
@ -3744,8 +3745,8 @@ ProjectionNames QueryAnalyzer::resolveExpressionNode(
|
||||
resolved_expression_it = resolved_expressions.find(node);
|
||||
if (resolved_expression_it != resolved_expressions.end())
|
||||
return resolved_expression_it->second;
|
||||
else
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR,
|
||||
throw Exception(
|
||||
ErrorCodes::LOGICAL_ERROR,
|
||||
"Identifier '{}' resolve into list node and list node projection names are not initialized. In scope {}",
|
||||
unresolved_identifier.getFullName(),
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
@ -4212,7 +4213,7 @@ NamesAndTypes QueryAnalyzer::resolveProjectionExpressionNodeList(QueryTreeNodePt
|
||||
|
||||
for (size_t i = 0; i < projection_nodes_size; ++i)
|
||||
{
|
||||
auto projection_node = projection_nodes[i];
|
||||
const auto & projection_node = projection_nodes[i];
|
||||
|
||||
if (!IdentifierResolver::isExpressionNodeType(projection_node->getNodeType()))
|
||||
throw Exception(ErrorCodes::UNSUPPORTED_METHOD,
|
||||
@ -4628,10 +4629,7 @@ void QueryAnalyzer::resolveTableFunction(QueryTreeNodePtr & table_function_node,
|
||||
"Unknown table function {}. Maybe you meant: {}",
|
||||
table_function_name,
|
||||
DB::toString(hints));
|
||||
else
|
||||
throw Exception(ErrorCodes::UNKNOWN_FUNCTION,
|
||||
"Unknown table function {}",
|
||||
table_function_name);
|
||||
throw Exception(ErrorCodes::UNKNOWN_FUNCTION, "Unknown table function {}", table_function_name);
|
||||
}
|
||||
|
||||
QueryTreeNodes result_table_function_arguments;
|
||||
@ -4667,7 +4665,7 @@ void QueryAnalyzer::resolveTableFunction(QueryTreeNodePtr & table_function_node,
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (auto * table_function_argument_function = table_function_argument->as<FunctionNode>())
|
||||
if (auto * table_function_argument_function = table_function_argument->as<FunctionNode>())
|
||||
{
|
||||
const auto & table_function_argument_function_name = table_function_argument_function->getFunctionName();
|
||||
if (TableFunctionFactory::instance().isTableFunctionName(table_function_argument_function_name))
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
updateAliasesIfNeeded(child, true /*is_lambda_node*/);
|
||||
return false;
|
||||
}
|
||||
else if (auto * query_tree_node = child->as<QueryNode>())
|
||||
if (auto * query_tree_node = child->as<QueryNode>())
|
||||
{
|
||||
if (query_tree_node->isCTE())
|
||||
return false;
|
||||
@ -58,7 +58,7 @@ public:
|
||||
updateAliasesIfNeeded(child, false /*is_lambda_node*/);
|
||||
return false;
|
||||
}
|
||||
else if (auto * union_node = child->as<UnionNode>())
|
||||
if (auto * union_node = child->as<UnionNode>())
|
||||
{
|
||||
if (union_node->isCTE())
|
||||
return false;
|
||||
|
@ -81,9 +81,9 @@ bool SortNode::isEqualImpl(const IQueryTreeNode & rhs, CompareOptions) const
|
||||
|
||||
if (!collator && !rhs_typed.collator)
|
||||
return true;
|
||||
else if (collator && !rhs_typed.collator)
|
||||
if (collator && !rhs_typed.collator)
|
||||
return false;
|
||||
else if (!collator && rhs_typed.collator)
|
||||
if (!collator && rhs_typed.collator)
|
||||
return false;
|
||||
|
||||
return collator->getLocale() == rhs_typed.collator->getLocale();
|
||||
|
@ -170,7 +170,7 @@ bool UnionNode::isEqualImpl(const IQueryTreeNode & rhs, CompareOptions) const
|
||||
if (recursive_cte_table && rhs_typed.recursive_cte_table &&
|
||||
recursive_cte_table->getStorageID() != rhs_typed.recursive_cte_table->getStorageID())
|
||||
return false;
|
||||
else if ((recursive_cte_table && !rhs_typed.recursive_cte_table) || (!recursive_cte_table && rhs_typed.recursive_cte_table))
|
||||
if ((recursive_cte_table && !rhs_typed.recursive_cte_table) || (!recursive_cte_table && rhs_typed.recursive_cte_table))
|
||||
return false;
|
||||
|
||||
return is_subquery == rhs_typed.is_subquery && is_cte == rhs_typed.is_cte && is_recursive_cte == rhs_typed.is_recursive_cte
|
||||
|
@ -156,19 +156,19 @@ std::string getGlobalInFunctionNameForLocalInFunctionName(const std::string & fu
|
||||
{
|
||||
if (function_name == "in")
|
||||
return "globalIn";
|
||||
else if (function_name == "notIn")
|
||||
if (function_name == "notIn")
|
||||
return "globalNotIn";
|
||||
else if (function_name == "nullIn")
|
||||
if (function_name == "nullIn")
|
||||
return "globalNullIn";
|
||||
else if (function_name == "notNullIn")
|
||||
if (function_name == "notNullIn")
|
||||
return "globalNotNullIn";
|
||||
else if (function_name == "inIgnoreSet")
|
||||
if (function_name == "inIgnoreSet")
|
||||
return "globalInIgnoreSet";
|
||||
else if (function_name == "notInIgnoreSet")
|
||||
if (function_name == "notInIgnoreSet")
|
||||
return "globalNotInIgnoreSet";
|
||||
else if (function_name == "nullInIgnoreSet")
|
||||
if (function_name == "nullInIgnoreSet")
|
||||
return "globalNullInIgnoreSet";
|
||||
else if (function_name == "notNullInIgnoreSet")
|
||||
if (function_name == "notNullInIgnoreSet")
|
||||
return "globalNotNullInIgnoreSet";
|
||||
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Invalid local IN function name {}", function_name);
|
||||
|
@ -173,9 +173,9 @@ private:
|
||||
|
||||
if (!lhs_child && !rhs_child)
|
||||
continue;
|
||||
else if (lhs_child && !rhs_child)
|
||||
if (lhs_child && !rhs_child)
|
||||
return false;
|
||||
else if (!lhs_child && rhs_child)
|
||||
if (!lhs_child && rhs_child)
|
||||
return false;
|
||||
|
||||
nodes_to_process.emplace_back(lhs_child.get(), rhs_child.get());
|
||||
|
@ -182,18 +182,16 @@ Strings BackupEntriesCollector::setStage(const String & new_stage, const String
|
||||
{
|
||||
return backup_coordination->waitForStage(new_stage, on_cluster_first_sync_timeout);
|
||||
}
|
||||
else if (new_stage.starts_with(Stage::GATHERING_METADATA))
|
||||
if (new_stage.starts_with(Stage::GATHERING_METADATA))
|
||||
{
|
||||
auto current_time = std::chrono::steady_clock::now();
|
||||
auto end_of_timeout = std::max(current_time, collect_metadata_end_time);
|
||||
return backup_coordination->waitForStage(
|
||||
new_stage, std::chrono::duration_cast<std::chrono::milliseconds>(end_of_timeout - current_time));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return backup_coordination->waitForStage(new_stage);
|
||||
}
|
||||
}
|
||||
|
||||
void BackupEntriesCollector::checkIsQueryCancelled() const
|
||||
{
|
||||
@ -716,23 +714,20 @@ bool BackupEntriesCollector::compareWithPrevious(String & mismatch_description)
|
||||
{
|
||||
if (mismatch->first == p_mismatch->first)
|
||||
return {MismatchType::CHANGED, mismatch->first};
|
||||
else if (mismatch->first < p_mismatch->first)
|
||||
if (mismatch->first < p_mismatch->first)
|
||||
return {MismatchType::ADDED, mismatch->first};
|
||||
else
|
||||
return {MismatchType::REMOVED, mismatch->first};
|
||||
}
|
||||
else if (mismatch != metadata.end())
|
||||
if (mismatch != metadata.end())
|
||||
{
|
||||
return {MismatchType::ADDED, mismatch->first};
|
||||
}
|
||||
else if (p_mismatch != previous_metadata.end())
|
||||
if (p_mismatch != previous_metadata.end())
|
||||
{
|
||||
return {MismatchType::REMOVED, p_mismatch->first};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return {MismatchType::NONE, {}};
|
||||
}
|
||||
};
|
||||
|
||||
/// Databases must be the same as during the previous scan.
|
||||
|
@ -14,9 +14,8 @@ namespace
|
||||
{
|
||||
if (!unencrypted_file_size)
|
||||
return copy_encrypted ? disk->getEncryptedFileSize(file_path) : disk->getFileSize(file_path);
|
||||
else if (copy_encrypted)
|
||||
if (copy_encrypted)
|
||||
return disk->getEncryptedFileSize(*unencrypted_file_size);
|
||||
else
|
||||
return *unencrypted_file_size;
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ std::unique_ptr<SeekableReadBuffer> BackupEntryFromImmutableFile::getReadBuffer(
|
||||
{
|
||||
if (copy_encrypted)
|
||||
return disk->readEncryptedFile(file_path, read_settings);
|
||||
else
|
||||
return disk->readFile(file_path, read_settings);
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user