From 94369e55d38e289d0d9c0f7ae28b0b0b536803f3 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Mon, 7 May 2018 05:01:11 +0300 Subject: [PATCH] Fixed style a bit [#CLICKHOUSE-2] --- cmake/dbms_generate_function.cmake | 13 +- .../AggregateFunctionSequenceMatch.h | 19 +-- .../ReservoirSamplerDeterministic.h | 8 +- dbms/src/Common/Config/ConfigProcessor.cpp | 3 +- dbms/src/Common/ExternalTable.h | 2 +- dbms/src/Common/Macros.cpp | 2 +- dbms/src/Common/Macros.h | 2 +- dbms/src/Common/StringSearcher.h | 20 ++- dbms/src/Core/BlockInfo.cpp | 2 +- dbms/src/Dictionaries/CacheDictionary.cpp | 41 ++---- .../ComplexKeyCacheDictionary.cpp | 24 +--- .../ComplexKeyHashedDictionary.cpp | 60 ++++---- .../Dictionaries/DictionarySourceFactory.cpp | 24 +--- dbms/src/Dictionaries/DictionaryStructure.cpp | 38 ++--- .../Embedded/GeoDictionariesLoader.cpp | 2 +- .../Embedded/RegionsHierarchy.cpp | 2 +- .../ExternalResultDescription.cpp | 4 +- dbms/src/Dictionaries/FlatDictionary.cpp | 43 ++---- dbms/src/Dictionaries/HashedDictionary.cpp | 39 ++---- .../Dictionaries/MongoDBBlockInputStream.cpp | 15 +- .../Dictionaries/MySQLBlockInputStream.cpp | 4 +- .../src/Dictionaries/ODBCBlockInputStream.cpp | 6 +- .../Dictionaries/RangeHashedDictionary.cpp | 19 +-- dbms/src/Dictionaries/TrieDictionary.cpp | 44 ++---- dbms/src/Functions/CMakeLists.txt | 130 +++++++++--------- dbms/src/Functions/FunctionsArithmetic.h | 22 +-- dbms/src/Functions/FunctionsArray.cpp | 15 +- dbms/src/Functions/FunctionsArray.h | 6 +- dbms/src/Functions/FunctionsComparison.h | 6 +- dbms/src/Functions/FunctionsConversion.h | 4 +- dbms/src/Functions/FunctionsDateTime.h | 19 ++- dbms/src/Functions/FunctionsHashing.h | 30 ++-- dbms/src/Functions/FunctionsMath.h | 22 +-- dbms/src/Functions/FunctionsString.cpp | 12 +- dbms/src/Functions/FunctionsTransform.h | 25 +--- .../Functions/registerFunctions_area.cpp.in | 2 - dbms/src/IO/ReadBufferAIO.cpp | 4 +- .../IExternalLoaderConfigRepository.h | 2 +- .../Interpreters/InterpreterCreateQuery.cpp | 2 +- dbms/src/Interpreters/PartLog.cpp | 2 +- dbms/src/Interpreters/SettingsCommon.h | 3 +- dbms/src/Parsers/iostream_debug_helpers.cpp | 7 +- dbms/src/Server/HTTPHandler.h | 2 +- dbms/src/Server/Server.cpp | 3 +- dbms/src/Server/TCPHandler.h | 4 +- dbms/src/Storages/AlterCommands.cpp | 14 +- .../Storages/Distributed/DirectoryMonitor.cpp | 7 +- .../DistributedBlockOutputStream.h | 2 +- dbms/src/Storages/MergeTree/MergeTreeData.cpp | 5 +- .../Storages/MergeTree/MergeTreeDataWriter.h | 2 +- .../MergeTree/MergedBlockOutputStream.cpp | 2 +- .../MergeTree/registerStorageMergeTree.cpp | 2 +- dbms/src/Storages/StorageJoin.cpp | 4 +- dbms/src/Storages/tests/merge_selector2.cpp | 6 +- 54 files changed, 282 insertions(+), 520 deletions(-) diff --git a/cmake/dbms_generate_function.cmake b/cmake/dbms_generate_function.cmake index 0ed4d6002a5..ef35a623e43 100644 --- a/cmake/dbms_generate_function.cmake +++ b/cmake/dbms_generate_function.cmake @@ -1,13 +1,10 @@ - function(generate_function_register FUNCTION_AREA) - - foreach(FUNCTION IN LISTS ARGN) - configure_file (registerFunction.h.in register${FUNCTION}.h) - configure_file (registerFunction.cpp.in register${FUNCTION}.cpp) - set(REGISTER_HEADERS "${REGISTER_HEADERS} #include \"register${FUNCTION}.h\"\n") - set(REGISTER_FUNCTIONS "${REGISTER_FUNCTIONS} register${FUNCTION}(factory);\n") + foreach(FUNCTION IN LISTS ARGN) + configure_file (registerFunction.h.in register${FUNCTION}.h) + configure_file (registerFunction.cpp.in register${FUNCTION}.cpp) + set(REGISTER_HEADERS "${REGISTER_HEADERS}#include \"register${FUNCTION}.h\"\n") + set(REGISTER_FUNCTIONS "${REGISTER_FUNCTIONS} register${FUNCTION}(factory);\n") endforeach() configure_file (registerFunctions_area.cpp.in registerFunctions${FUNCTION_AREA}.cpp) - endfunction() diff --git a/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.h b/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.h index b0e11e84d9e..48d059b0f14 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.h +++ b/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.h @@ -242,9 +242,7 @@ private: auto throw_exception = [&](const std::string & msg) { - throw Exception{ - msg + " '" + std::string(pos, end) + "' at position " + toString(pos - begin), - ErrorCodes::SYNTAX_ERROR}; + throw Exception{msg + " '" + std::string(pos, end) + "' at position " + toString(pos - begin), ErrorCodes::SYNTAX_ERROR}; }; auto match = [&pos, end](const char * str) mutable @@ -286,9 +284,7 @@ private: if (actions.back().type != PatternActionType::SpecificEvent && actions.back().type != PatternActionType::AnyEvent && actions.back().type != PatternActionType::KleeneStar) - throw Exception{ - "Temporal condition should be preceeded by an event condition", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{"Temporal condition should be preceeded by an event condition", ErrorCodes::BAD_ARGUMENTS}; actions.emplace_back(type, duration); } @@ -301,9 +297,7 @@ private: throw_exception("Could not parse number"); if (event_number > arg_count - 1) - throw Exception{ - "Event number " + toString(event_number) + " is out of range", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{"Event number " + toString(event_number) + " is out of range", ErrorCodes::BAD_ARGUMENTS}; actions.emplace_back(PatternActionType::SpecificEvent, event_number - 1); } @@ -428,13 +422,10 @@ protected: break; } else - throw Exception{ - "Unknown PatternActionType", - ErrorCodes::LOGICAL_ERROR}; + throw Exception{"Unknown PatternActionType", ErrorCodes::LOGICAL_ERROR}; if (++i > sequence_match_max_iterations) - throw Exception{ - "Pattern application proves too difficult, exceeding max iterations (" + toString(sequence_match_max_iterations) + ")", + throw Exception{"Pattern application proves too difficult, exceeding max iterations (" + toString(sequence_match_max_iterations) + ")", ErrorCodes::TOO_SLOW}; } diff --git a/dbms/src/AggregateFunctions/ReservoirSamplerDeterministic.h b/dbms/src/AggregateFunctions/ReservoirSamplerDeterministic.h index 44760d8e5a5..c543e662b2a 100644 --- a/dbms/src/AggregateFunctions/ReservoirSamplerDeterministic.h +++ b/dbms/src/AggregateFunctions/ReservoirSamplerDeterministic.h @@ -15,10 +15,10 @@ #include - /// Implementation of Reservoir Sampling algorithm. Incrementally selects from the added objects a random subset of the `sample_count` size. - /// Can approximately get quantiles. - /// The `quantile` call takes O(sample_count log sample_count), if after the previous call `quantile` there was at least one call to insert. Otherwise, O(1). - /// That is, it makes sense to first add, then get quantiles without adding. +/// Implementation of Reservoir Sampling algorithm. Incrementally selects from the added objects a random subset of the `sample_count` size. +/// Can approximately get quantiles. +/// The `quantile` call takes O(sample_count log sample_count), if after the previous call `quantile` there was at least one call to insert. Otherwise, O(1). +/// That is, it makes sense to first add, then get quantiles without adding. namespace DB diff --git a/dbms/src/Common/Config/ConfigProcessor.cpp b/dbms/src/Common/Config/ConfigProcessor.cpp index e303b580ba7..54f9ca58823 100644 --- a/dbms/src/Common/Config/ConfigProcessor.cpp +++ b/dbms/src/Common/Config/ConfigProcessor.cpp @@ -373,7 +373,8 @@ ConfigProcessor::Files ConfigProcessor::getConfigMergeFiles(const std::string & std::vector merge_dirs; merge_dirs.push_back(merge_dir_path.toString()); - if (merge_dir_path.getBaseName() != "conf") { + if (merge_dir_path.getBaseName() != "conf") + { merge_dir_path.setBaseName("conf"); merge_dirs.push_back(merge_dir_path.toString()); } diff --git a/dbms/src/Common/ExternalTable.h b/dbms/src/Common/ExternalTable.h index 7cc8069108b..c894b09c99b 100644 --- a/dbms/src/Common/ExternalTable.h +++ b/dbms/src/Common/ExternalTable.h @@ -165,7 +165,7 @@ public: /// Parsing of external table used when sending tables via http /// The `handlePart` function will be called for each table passed, - /// so it's also necessary to call `clean` at the end of the `handlePart`. +/// so it's also necessary to call `clean` at the end of the `handlePart`. class ExternalTablesHandler : public Poco::Net::PartHandler, BaseExternalTable { public: diff --git a/dbms/src/Common/Macros.cpp b/dbms/src/Common/Macros.cpp index 5d111abb0c6..d0bb1235741 100644 --- a/dbms/src/Common/Macros.cpp +++ b/dbms/src/Common/Macros.cpp @@ -76,7 +76,7 @@ Names Macros::expand(const Names & source_names, size_t level) const for (const String & name : source_names) result_names.push_back(expand(name, level)); - + return result_names; } } diff --git a/dbms/src/Common/Macros.h b/dbms/src/Common/Macros.h index 583aff7f18d..ce905723433 100644 --- a/dbms/src/Common/Macros.h +++ b/dbms/src/Common/Macros.h @@ -30,7 +30,7 @@ public: * level - the level of recursion. */ String expand(const String & s, size_t level = 0) const; - + /** Apply expand for the list. */ Names expand(const Names & source_names, size_t level = 0) const; diff --git a/dbms/src/Common/StringSearcher.h b/dbms/src/Common/StringSearcher.h index 4812dd3d329..f43fe6c717c 100644 --- a/dbms/src/Common/StringSearcher.h +++ b/dbms/src/Common/StringSearcher.h @@ -121,7 +121,7 @@ public: continue; } - const auto src_len = DB::UTF8::seqLength(*needle_pos); + const auto src_len = UTF8::seqLength(*needle_pos); const auto c_u32 = utf8.convert(needle_pos); const auto c_l_u32 = Poco::Unicode::toLower(c_u32); @@ -132,9 +132,7 @@ public: /// @note Unicode standard states it is a rare but possible occasion if (!(dst_l_len == dst_u_len && dst_u_len == src_len)) - throw DB::Exception{ - "UTF8 sequences with different lowercase and uppercase lengths are not supported", - DB::ErrorCodes::UNSUPPORTED_PARAMETER}; + throw Exception{"UTF8 sequences with different lowercase and uppercase lengths are not supported", ErrorCodes::UNSUPPORTED_PARAMETER}; cache_actual_len += src_len; if (cache_actual_len < n) @@ -183,7 +181,7 @@ public: Poco::Unicode::toLower(utf8.convert(needle_pos))) { /// @note assuming sequences for lowercase and uppercase have exact same length - const auto len = DB::UTF8::seqLength(*pos); + const auto len = UTF8::seqLength(*pos); pos += len, needle_pos += len; } @@ -207,7 +205,7 @@ public: Poco::Unicode::toLower(utf8.convert(pos)) == Poco::Unicode::toLower(utf8.convert(needle_pos))) { - const auto len = DB::UTF8::seqLength(*pos); + const auto len = UTF8::seqLength(*pos); pos += len, needle_pos += len; } @@ -240,7 +238,7 @@ public: if (mask == 0) { haystack += n; - DB::UTF8::syncForward(haystack, haystack_end); + UTF8::syncForward(haystack, haystack_end); continue; } @@ -267,7 +265,7 @@ public: Poco::Unicode::toLower(utf8.convert(needle_pos))) { /// @note assuming sequences for lowercase and uppercase have exact same length - const auto len = DB::UTF8::seqLength(*haystack_pos); + const auto len = UTF8::seqLength(*haystack_pos); haystack_pos += len, needle_pos += len; } @@ -279,7 +277,7 @@ public: return haystack; /// first octet was ok, but not the first 16, move to start of next sequence and reapply - haystack += DB::UTF8::seqLength(*haystack); + haystack += UTF8::seqLength(*haystack); continue; } } @@ -297,7 +295,7 @@ public: Poco::Unicode::toLower(utf8.convert(haystack_pos)) == Poco::Unicode::toLower(utf8.convert(needle_pos))) { - const auto len = DB::UTF8::seqLength(*haystack_pos); + const auto len = UTF8::seqLength(*haystack_pos); haystack_pos += len, needle_pos += len; } @@ -306,7 +304,7 @@ public: } /// advance to the start of the next sequence - haystack += DB::UTF8::seqLength(*haystack); + haystack += UTF8::seqLength(*haystack); } return haystack_end; diff --git a/dbms/src/Core/BlockInfo.cpp b/dbms/src/Core/BlockInfo.cpp index 9169288c7c1..77ef2e01007 100644 --- a/dbms/src/Core/BlockInfo.cpp +++ b/dbms/src/Core/BlockInfo.cpp @@ -20,7 +20,7 @@ namespace ErrorCodes /// Write values in binary form. NOTE: You could use protobuf, but it would be overkill for this case. void BlockInfo::write(WriteBuffer & out) const { - /// Set of pairs `FIELD_NUM`, value in binary form. Then 0. +/// Set of pairs `FIELD_NUM`, value in binary form. Then 0. #define WRITE_FIELD(TYPE, NAME, DEFAULT, FIELD_NUM) \ writeVarUInt(FIELD_NUM, out); \ writeBinary(NAME, out); diff --git a/dbms/src/Dictionaries/CacheDictionary.cpp b/dbms/src/Dictionaries/CacheDictionary.cpp index 37ed8173449..cae70322587 100644 --- a/dbms/src/Dictionaries/CacheDictionary.cpp +++ b/dbms/src/Dictionaries/CacheDictionary.cpp @@ -70,9 +70,7 @@ CacheDictionary::CacheDictionary(const std::string & name, const DictionaryStruc rnd_engine(randomSeed()) { if (!this->source_ptr->supportsSelectiveLoad()) - throw Exception{ - name + ": source cannot be used with CacheDictionary", - ErrorCodes::UNSUPPORTED_METHOD}; + throw Exception{name + ": source cannot be used with CacheDictionary", ErrorCodes::UNSUPPORTED_METHOD}; createAttributes(); } @@ -215,9 +213,7 @@ void CacheDictionary::get##TYPE(const std::string & attribute_name, const Padded {\ auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ const auto null_value = std::get(attribute.null_values);\ \ @@ -240,9 +236,7 @@ void CacheDictionary::getString(const std::string & attribute_name, const Padded { auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; const auto null_value = StringRef{std::get(attribute.null_values)}; @@ -256,9 +250,7 @@ void CacheDictionary::get##TYPE(\ {\ auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ getItemsNumber(attribute, ids, out, [&] (const size_t row) { return def[row]; });\ } @@ -281,9 +273,7 @@ void CacheDictionary::getString( { auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsString(attribute, ids, out, [&] (const size_t row) { return def->getDataAt(row); }); } @@ -294,9 +284,7 @@ void CacheDictionary::get##TYPE(\ {\ auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ getItemsNumber(attribute, ids, out, [&] (const size_t) { return def; });\ } @@ -319,9 +307,7 @@ void CacheDictionary::getString( { auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsString(attribute, ids, out, [&] (const size_t) { return StringRef{def}; }); } @@ -449,9 +435,7 @@ void CacheDictionary::createAttributes() hierarchical_attribute = &attributes.back(); if (hierarchical_attribute->type != AttributeUnderlyingType::UInt64) - throw Exception{ - name + ": hierarchical attribute must be UInt64.", - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": hierarchical attribute must be UInt64.", ErrorCodes::TYPE_MISMATCH}; } } } @@ -798,9 +782,7 @@ void CacheDictionary::update( { const auto id_column = typeid_cast(block.safeGetByPosition(0).column.get()); if (!id_column) - throw Exception{ - name + ": id column has type different from UInt64.", - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": id column has type different from UInt64.", ErrorCodes::TYPE_MISMATCH}; const auto & ids = id_column->getData(); @@ -973,10 +955,7 @@ CacheDictionary::Attribute & CacheDictionary::getAttribute(const std::string & a { const auto it = attribute_index_by_name.find(attribute_name); if (it == std::end(attribute_index_by_name)) - throw Exception{ - name + ": no such attribute '" + attribute_name + "'", - ErrorCodes::BAD_ARGUMENTS - }; + throw Exception{name + ": no such attribute '" + attribute_name + "'", ErrorCodes::BAD_ARGUMENTS}; return attributes[it->second]; } diff --git a/dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp b/dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp index fcd73cdb889..86fbfbb474e 100644 --- a/dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp +++ b/dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp @@ -59,9 +59,7 @@ ComplexKeyCacheDictionary::ComplexKeyCacheDictionary(const std::string & name, c rnd_engine(randomSeed()) { if (!this->source_ptr->supportsSelectiveLoad()) - throw Exception{ - name + ": source cannot be used with ComplexKeyCacheDictionary", - ErrorCodes::UNSUPPORTED_METHOD}; + throw Exception{name + ": source cannot be used with ComplexKeyCacheDictionary", ErrorCodes::UNSUPPORTED_METHOD}; createAttributes(); } @@ -78,9 +76,7 @@ void ComplexKeyCacheDictionary::getString( auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; const auto null_value = StringRef{std::get(attribute.null_values)}; @@ -95,9 +91,7 @@ void ComplexKeyCacheDictionary::getString( auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsString(attribute, key_columns, out, [&] (const size_t row) { return def->getDataAt(row); }); } @@ -110,9 +104,7 @@ void ComplexKeyCacheDictionary::getString( auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsString(attribute, key_columns, out, [&] (const size_t) { return StringRef{def}; }); } @@ -248,9 +240,7 @@ void ComplexKeyCacheDictionary::createAttributes() attributes.push_back(createAttributeWithType(attribute.underlying_type, attribute.null_value)); if (attribute.hierarchical) - throw Exception{ - name + ": hierarchical attributes not supported for dictionary of type " + getTypeName(), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": hierarchical attributes not supported for dictionary of type " + getTypeName(), ErrorCodes::TYPE_MISMATCH}; } } @@ -258,9 +248,7 @@ ComplexKeyCacheDictionary::Attribute & ComplexKeyCacheDictionary::getAttribute(c { const auto it = attribute_index_by_name.find(attribute_name); if (it == std::end(attribute_index_by_name)) - throw Exception{ - name + ": no such attribute '" + attribute_name + "'", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{name + ": no such attribute '" + attribute_name + "'", ErrorCodes::BAD_ARGUMENTS}; return attributes[it->second]; } diff --git a/dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp b/dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp index eaaeeab4e0a..1b84b1c66e0 100644 --- a/dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp +++ b/dbms/src/Dictionaries/ComplexKeyHashedDictionary.cpp @@ -51,9 +51,7 @@ void ComplexKeyHashedDictionary::get##TYPE(\ \ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ const auto null_value = std::get(attribute.null_values);\ \ @@ -82,9 +80,7 @@ void ComplexKeyHashedDictionary::getString( const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; const auto & null_value = StringRef{std::get(attribute.null_values)}; @@ -102,9 +98,7 @@ void ComplexKeyHashedDictionary::get##TYPE(\ \ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ getItemsNumber(attribute, key_columns,\ [&] (const size_t row, const auto value) { out[row] = value; },\ @@ -131,9 +125,7 @@ void ComplexKeyHashedDictionary::getString( const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsImpl(attribute, key_columns, [&] (const size_t, const StringRef value) { out->insertData(value.data, value.size); }, @@ -149,9 +141,7 @@ void ComplexKeyHashedDictionary::get##TYPE(\ \ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ getItemsNumber(attribute, key_columns,\ [&] (const size_t row, const auto value) { out[row] = value; },\ @@ -178,9 +168,7 @@ void ComplexKeyHashedDictionary::getString( const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsImpl(attribute, key_columns, [&] (const size_t, const StringRef value) { out->insertData(value.data, value.size); }, @@ -221,9 +209,7 @@ void ComplexKeyHashedDictionary::createAttributes() attributes.push_back(createAttributeWithType(attribute.underlying_type, attribute.null_value)); if (attribute.hierarchical) - throw Exception{ - name + ": hierarchical attributes not supported for dictionary of type " + getTypeName(), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": hierarchical attributes not supported for dictionary of type " + getTypeName(), ErrorCodes::TYPE_MISMATCH}; } } @@ -238,23 +224,26 @@ void ComplexKeyHashedDictionary::blockToAttributes(const Block & block) element_count += rows; const auto key_column_ptrs = ext::map(ext::range(0, keys_size), - [&](const size_t attribute_idx) { - return block.safeGetByPosition(attribute_idx).column; - }); + [&](const size_t attribute_idx) + { + return block.safeGetByPosition(attribute_idx).column; + }); const auto attribute_column_ptrs = ext::map(ext::range(0, attributes_size), - [&](const size_t attribute_idx) { - return block.safeGetByPosition( - keys_size + attribute_idx).column; - }); + [&](const size_t attribute_idx) + { + return block.safeGetByPosition(keys_size + attribute_idx).column; + }); - for (const auto row_idx : ext::range(0, rows)) { + for (const auto row_idx : ext::range(0, rows)) + { /// calculate key once per row const auto key = placeKeysInPool(row_idx, key_column_ptrs, keys, keys_pool); auto should_rollback = false; - for (const auto attribute_idx : ext::range(0, attributes_size)) { + for (const auto attribute_idx : ext::range(0, attributes_size)) + { const auto &attribute_column = *attribute_column_ptrs[attribute_idx]; auto &attribute = attributes[attribute_idx]; const auto inserted = setAttributeValue(attribute, key, attribute_column[row_idx]); @@ -354,7 +343,8 @@ void ComplexKeyHashedDictionary::updateData() void ComplexKeyHashedDictionary::loadData() { - if (!source_ptr->hasUpdateField()) { + if (!source_ptr->hasUpdateField()) + { auto stream = source_ptr->loadAll(); stream->readPrefix(); @@ -367,9 +357,7 @@ void ComplexKeyHashedDictionary::loadData() updateData(); if (require_nonempty && 0 == element_count) - throw Exception{ - name + ": dictionary source is empty and 'require_nonempty' property is set.", - ErrorCodes::DICTIONARY_IS_EMPTY}; + throw Exception{name + ": dictionary source is empty and 'require_nonempty' property is set.", ErrorCodes::DICTIONARY_IS_EMPTY}; } template @@ -546,9 +534,7 @@ const ComplexKeyHashedDictionary::Attribute & ComplexKeyHashedDictionary::getAtt { const auto it = attribute_index_by_name.find(attribute_name); if (it == std::end(attribute_index_by_name)) - throw Exception{ - name + ": no such attribute '" + attribute_name + "'", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{name + ": no such attribute '" + attribute_name + "'", ErrorCodes::BAD_ARGUMENTS}; return attributes[it->second]; } diff --git a/dbms/src/Dictionaries/DictionarySourceFactory.cpp b/dbms/src/Dictionaries/DictionarySourceFactory.cpp index 6c9c355893d..e77a1189233 100644 --- a/dbms/src/Dictionaries/DictionarySourceFactory.cpp +++ b/dbms/src/Dictionaries/DictionarySourceFactory.cpp @@ -53,8 +53,7 @@ Block createSampleBlock(const DictionaryStructure & dict_struct) Block block; if (dict_struct.id) - block.insert(ColumnWithTypeAndName{ - ColumnUInt64::create(1, 0), std::make_shared(), dict_struct.id->name}); + block.insert(ColumnWithTypeAndName{ColumnUInt64::create(1, 0), std::make_shared(), dict_struct.id->name}); if (dict_struct.key) { @@ -109,10 +108,7 @@ DictionarySourcePtr DictionarySourceFactory::create( Poco::Util::AbstractConfiguration::Keys keys; config.keys(config_prefix, keys); if (keys.size() != 1) - throw Exception{ - name +": element dictionary.source should have exactly one child element", - ErrorCodes::EXCESSIVE_ELEMENT_IN_CONFIG - }; + throw Exception{name +": element dictionary.source should have exactly one child element", ErrorCodes::EXCESSIVE_ELEMENT_IN_CONFIG}; auto sample_block = createSampleBlock(dict_struct); @@ -121,9 +117,7 @@ DictionarySourcePtr DictionarySourceFactory::create( if ("file" == source_type) { if (dict_struct.has_expressions) - throw Exception{ - "Dictionary source of type `file` does not support attribute expressions", - ErrorCodes::LOGICAL_ERROR}; + throw Exception{"Dictionary source of type `file` does not support attribute expressions", ErrorCodes::LOGICAL_ERROR}; const auto filename = config.getString(config_prefix + ".file.path"); const auto format = config.getString(config_prefix + ".file.format"); @@ -164,9 +158,7 @@ DictionarySourcePtr DictionarySourceFactory::create( else if ("executable" == source_type) { if (dict_struct.has_expressions) - throw Exception{ - "Dictionary source of type `executable` does not support attribute expressions", - ErrorCodes::LOGICAL_ERROR}; + throw Exception{"Dictionary source of type `executable` does not support attribute expressions", ErrorCodes::LOGICAL_ERROR}; return std::make_unique(dict_struct, config, config_prefix + ".executable", sample_block, context); } @@ -174,9 +166,7 @@ DictionarySourcePtr DictionarySourceFactory::create( { if (dict_struct.has_expressions) - throw Exception{ - "Dictionary source of type `http` does not support attribute expressions", - ErrorCodes::LOGICAL_ERROR}; + throw Exception{"Dictionary source of type `http` does not support attribute expressions", ErrorCodes::LOGICAL_ERROR}; #if Poco_NetSSL_FOUND // Used for https queries @@ -199,9 +189,7 @@ DictionarySourcePtr DictionarySourceFactory::create( } } - throw Exception{ - name + ": unknown dictionary source type: " + source_type, - ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG}; + throw Exception{name + ": unknown dictionary source type: " + source_type, ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG}; } } diff --git a/dbms/src/Dictionaries/DictionaryStructure.cpp b/dbms/src/Dictionaries/DictionaryStructure.cpp index 9989bb64173..f5e84cd0110 100644 --- a/dbms/src/Dictionaries/DictionaryStructure.cpp +++ b/dbms/src/Dictionaries/DictionaryStructure.cpp @@ -83,9 +83,7 @@ AttributeUnderlyingType getAttributeUnderlyingType(const std::string & type) if (it != std::end(dictionary)) return it->second; - throw Exception{ - "Unknown type " + type, - ErrorCodes::UNKNOWN_TYPE}; + throw Exception{"Unknown type " + type, ErrorCodes::UNKNOWN_TYPE}; } @@ -107,9 +105,7 @@ std::string toString(const AttributeUnderlyingType type) case AttributeUnderlyingType::String: return "String"; } - throw Exception{ - "Unknown attribute_type " + toString(static_cast(type)), - ErrorCodes::ARGUMENT_OUT_OF_BOUND}; + throw Exception{"Unknown attribute_type " + toString(static_cast(type)), ErrorCodes::ARGUMENT_OUT_OF_BOUND}; } @@ -118,9 +114,7 @@ DictionarySpecialAttribute::DictionarySpecialAttribute(const Poco::Util::Abstrac expression{config.getString(config_prefix + ".expression", "")} { if (name.empty() && !expression.empty()) - throw Exception{ - "Element " + config_prefix + ".name is empty", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{"Element " + config_prefix + ".name is empty", ErrorCodes::BAD_ARGUMENTS}; } @@ -169,9 +163,7 @@ DictionaryStructure::DictionaryStructure(const Poco::Util::AbstractConfiguration void DictionaryStructure::validateKeyTypes(const DataTypes & key_types) const { if (key_types.size() != key->size()) - throw Exception{ - "Key structure does not match, expected " + getKeyDescription(), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{"Key structure does not match, expected " + getKeyDescription(), ErrorCodes::TYPE_MISMATCH}; for (const auto i : ext::range(0, key_types.size())) { @@ -179,10 +171,8 @@ void DictionaryStructure::validateKeyTypes(const DataTypes & key_types) const const auto & actual_type = key_types[i]->getName(); if (expected_type != actual_type) - throw Exception{ - "Key type at position " + std::to_string(i) + " does not match, expected " + expected_type + - ", found " + actual_type, - ErrorCodes::TYPE_MISMATCH}; + throw Exception{"Key type at position " + std::to_string(i) + " does not match, expected " + expected_type + + ", found " + actual_type, ErrorCodes::TYPE_MISMATCH}; } } @@ -240,9 +230,7 @@ static void CheckAttributeKeys(const Poco::Util::AbstractConfiguration::Keys & k for (const auto & key : keys) { if (valid_keys.find(key) == valid_keys.end()) - throw Exception{ - "Unknown key '" + key + "' inside attribute section", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{"Unknown key '" + key + "' inside attribute section", ErrorCodes::BAD_ARGUMENTS}; } } @@ -298,19 +286,13 @@ std::vector DictionaryStructure::getAttributes( const auto injective = config.getBool(prefix + "injective", false); const auto is_object_id = config.getBool(prefix + "is_object_id", false); if (name.empty()) - throw Exception{ - "Properties 'name' and 'type' of an attribute cannot be empty", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{"Properties 'name' and 'type' of an attribute cannot be empty", ErrorCodes::BAD_ARGUMENTS}; if (has_hierarchy && !hierarchy_allowed) - throw Exception{ - "Hierarchy not allowed in '" + prefix, - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{"Hierarchy not allowed in '" + prefix, ErrorCodes::BAD_ARGUMENTS}; if (has_hierarchy && hierarchical) - throw Exception{ - "Only one hierarchical attribute supported", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{"Only one hierarchical attribute supported", ErrorCodes::BAD_ARGUMENTS}; has_hierarchy = has_hierarchy || hierarchical; diff --git a/dbms/src/Dictionaries/Embedded/GeoDictionariesLoader.cpp b/dbms/src/Dictionaries/Embedded/GeoDictionariesLoader.cpp index 7a32fb31be1..2d2967e72a1 100644 --- a/dbms/src/Dictionaries/Embedded/GeoDictionariesLoader.cpp +++ b/dbms/src/Dictionaries/Embedded/GeoDictionariesLoader.cpp @@ -13,7 +13,7 @@ std::unique_ptr GeoDictionariesLoader::reloadRegionsHierarch return {}; const auto default_hierarchy_file = config.getString(config_key); - auto data_provider = std::make_unique(default_hierarchy_file); + auto data_provider = std::make_unique(default_hierarchy_file); return std::make_unique(std::move(data_provider)); } diff --git a/dbms/src/Dictionaries/Embedded/RegionsHierarchy.cpp b/dbms/src/Dictionaries/Embedded/RegionsHierarchy.cpp index de39090568f..2dbab26acc1 100644 --- a/dbms/src/Dictionaries/Embedded/RegionsHierarchy.cpp +++ b/dbms/src/Dictionaries/Embedded/RegionsHierarchy.cpp @@ -42,7 +42,7 @@ void RegionsHierarchy::reload() RegionID max_region_id = 0; - auto regions_reader = data_source->createReader(); + auto regions_reader = data_source->createReader(); RegionEntry region_entry; while (regions_reader->readNext(region_entry)) diff --git a/dbms/src/Dictionaries/ExternalResultDescription.cpp b/dbms/src/Dictionaries/ExternalResultDescription.cpp index 5eca329e5f2..18788606be7 100644 --- a/dbms/src/Dictionaries/ExternalResultDescription.cpp +++ b/dbms/src/Dictionaries/ExternalResultDescription.cpp @@ -56,9 +56,7 @@ void ExternalResultDescription::init(const Block & sample_block_) else if (typeid_cast(type)) types.push_back(ValueType::DateTime); else - throw Exception{ - "Unsupported type " + type->getName(), - ErrorCodes::UNKNOWN_TYPE}; + throw Exception{"Unsupported type " + type->getName(), ErrorCodes::UNKNOWN_TYPE}; names.emplace_back(column.name); sample_columns.emplace_back(column.column); diff --git a/dbms/src/Dictionaries/FlatDictionary.cpp b/dbms/src/Dictionaries/FlatDictionary.cpp index e1341907649..c758b0d0a9a 100644 --- a/dbms/src/Dictionaries/FlatDictionary.cpp +++ b/dbms/src/Dictionaries/FlatDictionary.cpp @@ -117,9 +117,7 @@ void FlatDictionary::get##TYPE(const std::string & attribute_name, const PaddedP {\ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ const auto null_value = std::get(attribute.null_values);\ \ @@ -144,9 +142,7 @@ void FlatDictionary::getString(const std::string & attribute_name, const PaddedP { const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; const auto & null_value = std::get(attribute.null_values); @@ -162,9 +158,7 @@ void FlatDictionary::get##TYPE(\ {\ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ getItemsNumber(attribute, ids,\ [&] (const size_t row, const auto value) { out[row] = value; },\ @@ -189,9 +183,7 @@ void FlatDictionary::getString( { const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsImpl(attribute, ids, [&] (const size_t, const StringRef value) { out->insertData(value.data, value.size); }, @@ -205,9 +197,7 @@ void FlatDictionary::get##TYPE(\ {\ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ getItemsNumber(attribute, ids,\ [&] (const size_t row, const auto value) { out[row] = value; },\ @@ -232,9 +222,7 @@ void FlatDictionary::getString( { const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; FlatDictionary::getItemsImpl(attribute, ids, [&] (const size_t, const StringRef value) { out->insertData(value.data, value.size); }, @@ -279,9 +267,7 @@ void FlatDictionary::createAttributes() hierarchical_attribute = &attributes.back(); if (hierarchical_attribute->type != AttributeUnderlyingType::UInt64) - throw Exception{ - name + ": hierarchical attribute must be UInt64.", - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": hierarchical attribute must be UInt64.", ErrorCodes::TYPE_MISMATCH}; } } } @@ -374,7 +360,8 @@ void FlatDictionary::updateData() void FlatDictionary::loadData() { - if (!source_ptr->hasUpdateField()) { + if (!source_ptr->hasUpdateField()) + { auto stream = source_ptr->loadAll(); stream->readPrefix(); @@ -387,9 +374,7 @@ void FlatDictionary::loadData() updateData(); if (require_nonempty && 0 == element_count) - throw Exception{ - name + ": dictionary source is empty and 'require_nonempty' property is set.", - ErrorCodes::DICTIONARY_IS_EMPTY}; + throw Exception{name + ": dictionary source is empty and 'require_nonempty' property is set.", ErrorCodes::DICTIONARY_IS_EMPTY}; } @@ -530,9 +515,7 @@ template void FlatDictionary::resize(Attribute & attribute, const Key id) { if (id >= max_array_size) - throw Exception{ - name + ": identifier should be less than " + toString(max_array_size), - ErrorCodes::ARGUMENT_OUT_OF_BOUND}; + throw Exception{name + ": identifier should be less than " + toString(max_array_size), ErrorCodes::ARGUMENT_OUT_OF_BOUND}; auto & array = *std::get>(attribute.arrays); if (id >= array.size()) @@ -586,9 +569,7 @@ const FlatDictionary::Attribute & FlatDictionary::getAttribute(const std::string { const auto it = attribute_index_by_name.find(attribute_name); if (it == std::end(attribute_index_by_name)) - throw Exception{ - name + ": no such attribute '" + attribute_name + "'", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{name + ": no such attribute '" + attribute_name + "'", ErrorCodes::BAD_ARGUMENTS}; return attributes[it->second]; } diff --git a/dbms/src/Dictionaries/HashedDictionary.cpp b/dbms/src/Dictionaries/HashedDictionary.cpp index 09880cdbeb5..708ef118016 100644 --- a/dbms/src/Dictionaries/HashedDictionary.cpp +++ b/dbms/src/Dictionaries/HashedDictionary.cpp @@ -114,9 +114,7 @@ void HashedDictionary::get##TYPE(const std::string & attribute_name, const Padde {\ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ const auto null_value = std::get(attribute.null_values);\ \ @@ -141,9 +139,7 @@ void HashedDictionary::getString(const std::string & attribute_name, const Padde { const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; const auto & null_value = StringRef{std::get(attribute.null_values)}; @@ -159,9 +155,7 @@ void HashedDictionary::get##TYPE(\ {\ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ getItemsNumber(attribute, ids,\ [&] (const size_t row, const auto value) { out[row] = value; },\ @@ -186,9 +180,7 @@ void HashedDictionary::getString( { const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsImpl(attribute, ids, [&] (const size_t, const StringRef value) { out->insertData(value.data, value.size); }, @@ -201,9 +193,7 @@ void HashedDictionary::get##TYPE(\ {\ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ getItemsNumber(attribute, ids,\ [&] (const size_t row, const auto value) { out[row] = value; },\ @@ -228,9 +218,7 @@ void HashedDictionary::getString( { const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsImpl(attribute, ids, [&] (const size_t, const StringRef value) { out->insertData(value.data, value.size); }, @@ -273,9 +261,7 @@ void HashedDictionary::createAttributes() hierarchical_attribute = &attributes.back(); if (hierarchical_attribute->type != AttributeUnderlyingType::UInt64) - throw Exception{ - name + ": hierarchical attribute must be UInt64.", - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": hierarchical attribute must be UInt64.", ErrorCodes::TYPE_MISMATCH}; } } } @@ -368,7 +354,8 @@ void HashedDictionary::updateData() void HashedDictionary::loadData() { - if (!source_ptr->hasUpdateField()) { + if (!source_ptr->hasUpdateField()) + { auto stream = source_ptr->loadAll(); stream->readPrefix(); @@ -381,9 +368,7 @@ void HashedDictionary::loadData() updateData(); if (require_nonempty && 0 == element_count) - throw Exception{ - name + ": dictionary source is empty and 'require_nonempty' property is set.", - ErrorCodes::DICTIONARY_IS_EMPTY}; + throw Exception{name + ": dictionary source is empty and 'require_nonempty' property is set.", ErrorCodes::DICTIONARY_IS_EMPTY}; } template @@ -545,9 +530,7 @@ const HashedDictionary::Attribute & HashedDictionary::getAttribute(const std::st { const auto it = attribute_index_by_name.find(attribute_name); if (it == std::end(attribute_index_by_name)) - throw Exception{ - name + ": no such attribute '" + attribute_name + "'", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{name + ": no such attribute '" + attribute_name + "'", ErrorCodes::BAD_ARGUMENTS}; return attributes[it->second]; } diff --git a/dbms/src/Dictionaries/MongoDBBlockInputStream.cpp b/dbms/src/Dictionaries/MongoDBBlockInputStream.cpp index b5f1d1f6f69..20c2d655d85 100644 --- a/dbms/src/Dictionaries/MongoDBBlockInputStream.cpp +++ b/dbms/src/Dictionaries/MongoDBBlockInputStream.cpp @@ -104,17 +104,15 @@ namespace break; } - throw Exception{ - "Type mismatch, expected String, got type id = " + toString(value.type()) + - " for column " + name, ErrorCodes::TYPE_MISMATCH}; + throw Exception{"Type mismatch, expected String, got type id = " + toString(value.type()) + + " for column " + name, ErrorCodes::TYPE_MISMATCH}; } case ValueType::Date: { if (value.type() != Poco::MongoDB::ElementTraits::TypeId) - throw Exception{ - "Type mismatch, expected Timestamp, got type id = " + toString(value.type()) + - " for column " + name, ErrorCodes::TYPE_MISMATCH}; + throw Exception{"Type mismatch, expected Timestamp, got type id = " + toString(value.type()) + + " for column " + name, ErrorCodes::TYPE_MISMATCH}; static_cast(column).getData().push_back( UInt16{DateLUT::instance().toDayNum( @@ -125,9 +123,8 @@ namespace case ValueType::DateTime: { if (value.type() != Poco::MongoDB::ElementTraits::TypeId) - throw Exception{ - "Type mismatch, expected Timestamp, got type id = " + toString(value.type()) + - " for column " + name, ErrorCodes::TYPE_MISMATCH}; + throw Exception{"Type mismatch, expected Timestamp, got type id = " + toString(value.type()) + + " for column " + name, ErrorCodes::TYPE_MISMATCH}; static_cast(column).getData().push_back( static_cast &>(value).value().epochTime()); diff --git a/dbms/src/Dictionaries/MySQLBlockInputStream.cpp b/dbms/src/Dictionaries/MySQLBlockInputStream.cpp index 6e2275cd105..3f2d192cce9 100644 --- a/dbms/src/Dictionaries/MySQLBlockInputStream.cpp +++ b/dbms/src/Dictionaries/MySQLBlockInputStream.cpp @@ -24,9 +24,7 @@ MySQLBlockInputStream::MySQLBlockInputStream( max_block_size{max_block_size} { if (sample_block.columns() != result.getNumFields()) - throw Exception{ - "mysqlxx::UseQueryResult contains " + toString(result.getNumFields()) + " columns while " + - toString(sample_block.columns()) + " expected", + throw Exception{"mysqlxx::UseQueryResult contains " + toString(result.getNumFields()) + " columns while " + toString(sample_block.columns()) + " expected", ErrorCodes::NUMBER_OF_COLUMNS_DOESNT_MATCH}; description.init(sample_block); diff --git a/dbms/src/Dictionaries/ODBCBlockInputStream.cpp b/dbms/src/Dictionaries/ODBCBlockInputStream.cpp index 8b186f6791e..a90c770b8b2 100644 --- a/dbms/src/Dictionaries/ODBCBlockInputStream.cpp +++ b/dbms/src/Dictionaries/ODBCBlockInputStream.cpp @@ -29,10 +29,8 @@ ODBCBlockInputStream::ODBCBlockInputStream( log(&Logger::get("ODBCBlockInputStream")) { if (sample_block.columns() != result.columnCount()) - throw Exception{ - "RecordSet contains " + toString(result.columnCount()) + " columns while " + - toString(sample_block.columns()) + " expected", - ErrorCodes::NUMBER_OF_COLUMNS_DOESNT_MATCH}; + throw Exception{"RecordSet contains " + toString(result.columnCount()) + " columns while " + + toString(sample_block.columns()) + " expected", ErrorCodes::NUMBER_OF_COLUMNS_DOESNT_MATCH}; description.init(sample_block); } diff --git a/dbms/src/Dictionaries/RangeHashedDictionary.cpp b/dbms/src/Dictionaries/RangeHashedDictionary.cpp index 2a73a43b84e..fc938143176 100644 --- a/dbms/src/Dictionaries/RangeHashedDictionary.cpp +++ b/dbms/src/Dictionaries/RangeHashedDictionary.cpp @@ -102,9 +102,7 @@ void RangeHashedDictionary::createAttributes() attributes.push_back(createAttributeWithType(attribute.underlying_type, attribute.null_value)); if (attribute.hierarchical) - throw Exception{ - name + ": hierarchical attributes not supported by " + getName() + " dictionary.", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{name + ": hierarchical attributes not supported by " + getName() + " dictionary.", ErrorCodes::BAD_ARGUMENTS}; } } @@ -136,9 +134,7 @@ void RangeHashedDictionary::loadData() stream->readSuffix(); if (require_nonempty && 0 == element_count) - throw Exception{ - name + ": dictionary source is empty and 'require_nonempty' property is set.", - ErrorCodes::DICTIONARY_IS_EMPTY}; + throw Exception{name + ": dictionary source is empty and 'require_nonempty' property is set.", ErrorCodes::DICTIONARY_IS_EMPTY}; } template @@ -284,7 +280,8 @@ void RangeHashedDictionary::setAttributeValueImpl(Attribute & attribute, const K auto & values = it->second; const auto insert_it = std::lower_bound(std::begin(values), std::end(values), range, - [] (const Value & lhs, const Range & range) { + [] (const Value & lhs, const Range & range) + { return lhs.range < range; }); @@ -342,9 +339,7 @@ const RangeHashedDictionary::Attribute & RangeHashedDictionary::getAttribute(con { const auto it = attribute_index_by_name.find(attribute_name); if (it == std::end(attribute_index_by_name)) - throw Exception{ - name + ": no such attribute '" + attribute_name + "'", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{name + ": no such attribute '" + attribute_name + "'", ErrorCodes::BAD_ARGUMENTS}; return attributes[it->second]; } @@ -353,9 +348,7 @@ const RangeHashedDictionary::Attribute & RangeHashedDictionary::getAttributeWith { const auto & attribute = getAttribute(name); if (attribute.type != type) - throw Exception{ - name + ": type mismatch: attribute " + name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; return attribute; } diff --git a/dbms/src/Dictionaries/TrieDictionary.cpp b/dbms/src/Dictionaries/TrieDictionary.cpp index 99cf29c8ca1..52227a6c1d4 100644 --- a/dbms/src/Dictionaries/TrieDictionary.cpp +++ b/dbms/src/Dictionaries/TrieDictionary.cpp @@ -68,9 +68,7 @@ void TrieDictionary::get##TYPE(\ \ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ const auto null_value = std::get(attribute.null_values);\ \ @@ -99,9 +97,7 @@ void TrieDictionary::getString( const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; const auto & null_value = StringRef{std::get(attribute.null_values)}; @@ -119,9 +115,7 @@ void TrieDictionary::get##TYPE(\ \ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ getItemsNumber(attribute, key_columns,\ [&] (const size_t row, const auto value) { out[row] = value; },\ @@ -148,9 +142,7 @@ void TrieDictionary::getString( const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsImpl(attribute, key_columns, [&] (const size_t, const StringRef value) { out->insertData(value.data, value.size); }, @@ -166,9 +158,7 @@ void TrieDictionary::get##TYPE(\ \ const auto & attribute = getAttribute(attribute_name);\ if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::TYPE))\ - throw Exception{\ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type),\ - ErrorCodes::TYPE_MISMATCH};\ + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH};\ \ getItemsNumber(attribute, key_columns,\ [&] (const size_t row, const auto value) { out[row] = value; },\ @@ -195,9 +185,7 @@ void TrieDictionary::getString( const auto & attribute = getAttribute(attribute_name); if (!isAttributeTypeConvertibleTo(attribute.type, AttributeUnderlyingType::String)) - throw Exception{ - name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": type mismatch: attribute " + attribute_name + " has type " + toString(attribute.type), ErrorCodes::TYPE_MISMATCH}; getItemsImpl(attribute, key_columns, [&] (const size_t, const StringRef value) { out->insertData(value.data, value.size); }, @@ -238,9 +226,7 @@ void TrieDictionary::createAttributes() attributes.push_back(createAttributeWithType(attribute.underlying_type, attribute.null_value)); if (attribute.hierarchical) - throw Exception{ - name + ": hierarchical attributes not supported for dictionary of type " + getTypeName(), - ErrorCodes::TYPE_MISMATCH}; + throw Exception{name + ": hierarchical attributes not supported for dictionary of type " + getTypeName(), ErrorCodes::TYPE_MISMATCH}; } } @@ -290,9 +276,7 @@ void TrieDictionary::loadData() stream->readSuffix(); if (require_nonempty && 0 == element_count) - throw Exception{ - name + ": dictionary source is empty and 'require_nonempty' property is set.", - ErrorCodes::DICTIONARY_IS_EMPTY}; + throw Exception{name + ": dictionary source is empty and 'require_nonempty' property is set.", ErrorCodes::DICTIONARY_IS_EMPTY}; } template @@ -338,16 +322,12 @@ void TrieDictionary::calculateBytesAllocated() void TrieDictionary::validateKeyTypes(const DataTypes & key_types) const { if (key_types.size() != 1) - throw Exception{ - "Expected a single IP address", - ErrorCodes::TYPE_MISMATCH}; + throw Exception{"Expected a single IP address", ErrorCodes::TYPE_MISMATCH}; const auto & actual_type = key_types[0]->getName(); if (actual_type != "UInt32" && actual_type != "FixedString(16)") - throw Exception{ - "Key does not match, expected either UInt32 or FixedString(16)", - ErrorCodes::TYPE_MISMATCH}; + throw Exception{"Key does not match, expected either UInt32 or FixedString(16)", ErrorCodes::TYPE_MISMATCH}; } @@ -526,9 +506,7 @@ const TrieDictionary::Attribute & TrieDictionary::getAttribute(const std::string { const auto it = attribute_index_by_name.find(attribute_name); if (it == std::end(attribute_index_by_name)) - throw Exception{ - name + ": no such attribute '" + attribute_name + "'", - ErrorCodes::BAD_ARGUMENTS}; + throw Exception{name + ": no such attribute '" + attribute_name + "'", ErrorCodes::BAD_ARGUMENTS}; return attributes[it->second]; } diff --git a/dbms/src/Functions/CMakeLists.txt b/dbms/src/Functions/CMakeLists.txt index 1febb4aa20c..06de43ea98b 100644 --- a/dbms/src/Functions/CMakeLists.txt +++ b/dbms/src/Functions/CMakeLists.txt @@ -2,77 +2,77 @@ include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake) include(${ClickHouse_SOURCE_DIR}/cmake/dbms_generate_function.cmake) generate_function_register(Arithmetic - FunctionPlus - FunctionMinus - FunctionMultiply - FunctionDivideFloating - FunctionDivideIntegral - FunctionDivideIntegralOrZero - FunctionModulo - FunctionNegate - FunctionAbs - FunctionBitAnd - FunctionBitOr - FunctionBitXor - FunctionBitNot - FunctionBitShiftLeft - FunctionBitShiftRight - FunctionBitRotateLeft - FunctionBitRotateRight - FunctionLeast - FunctionGreatest - FunctionBitTest - FunctionBitTestAny - FunctionBitTestAll - FunctionGCD - FunctionLCM - FunctionIntExp2 - FunctionIntExp10 + FunctionPlus + FunctionMinus + FunctionMultiply + FunctionDivideFloating + FunctionDivideIntegral + FunctionDivideIntegralOrZero + FunctionModulo + FunctionNegate + FunctionAbs + FunctionBitAnd + FunctionBitOr + FunctionBitXor + FunctionBitNot + FunctionBitShiftLeft + FunctionBitShiftRight + FunctionBitRotateLeft + FunctionBitRotateRight + FunctionLeast + FunctionGreatest + FunctionBitTest + FunctionBitTestAny + FunctionBitTestAll + FunctionGCD + FunctionLCM + FunctionIntExp2 + FunctionIntExp10 ) generate_function_register(Array - FunctionArray - FunctionArrayElement - FunctionHas - FunctionIndexOf - FunctionCountEqual - FunctionArrayEnumerate - FunctionArrayEnumerateUniq - FunctionArrayUniq - FunctionEmptyArrayUInt8 - FunctionEmptyArrayUInt16 - FunctionEmptyArrayUInt32 - FunctionEmptyArrayUInt64 - FunctionEmptyArrayInt8 - FunctionEmptyArrayInt16 - FunctionEmptyArrayInt32 - FunctionEmptyArrayInt64 - FunctionEmptyArrayFloat32 - FunctionEmptyArrayFloat64 - FunctionEmptyArrayDate - FunctionEmptyArrayDateTime - FunctionEmptyArrayString - FunctionEmptyArrayToSingle - FunctionRange - FunctionArrayReduce - FunctionArrayReverse - FunctionArrayConcat - FunctionArraySlice - FunctionArrayPushBack - FunctionArrayPushFront - FunctionArrayPopBack - FunctionArrayPopFront - FunctionArrayHasAll - FunctionArrayHasAny - FunctionArrayIntersect - FunctionArrayResize + FunctionArray + FunctionArrayElement + FunctionHas + FunctionIndexOf + FunctionCountEqual + FunctionArrayEnumerate + FunctionArrayEnumerateUniq + FunctionArrayUniq + FunctionEmptyArrayUInt8 + FunctionEmptyArrayUInt16 + FunctionEmptyArrayUInt32 + FunctionEmptyArrayUInt64 + FunctionEmptyArrayInt8 + FunctionEmptyArrayInt16 + FunctionEmptyArrayInt32 + FunctionEmptyArrayInt64 + FunctionEmptyArrayFloat32 + FunctionEmptyArrayFloat64 + FunctionEmptyArrayDate + FunctionEmptyArrayDateTime + FunctionEmptyArrayString + FunctionEmptyArrayToSingle + FunctionRange + FunctionArrayReduce + FunctionArrayReverse + FunctionArrayConcat + FunctionArraySlice + FunctionArrayPushBack + FunctionArrayPushFront + FunctionArrayPopBack + FunctionArrayPopFront + FunctionArrayHasAll + FunctionArrayHasAny + FunctionArrayIntersect + FunctionArrayResize ) generate_function_register(Projection - FunctionOneOrZero - FunctionProject - FunctionBuildProjectionComposition - FunctionRestoreProjection + FunctionOneOrZero + FunctionProject + FunctionBuildProjectionComposition + FunctionRestoreProjection ) diff --git a/dbms/src/Functions/FunctionsArithmetic.h b/dbms/src/Functions/FunctionsArithmetic.h index 16367f0b8b8..94c56afee67 100644 --- a/dbms/src/Functions/FunctionsArithmetic.h +++ b/dbms/src/Functions/FunctionsArithmetic.h @@ -1114,17 +1114,13 @@ public: DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override { if (arguments.size() < 2) - throw Exception{ - "Number of arguments for function " + getName() + " doesn't match: passed " - + toString(arguments.size()) + ", should be at least 2.", - ErrorCodes::TOO_LESS_ARGUMENTS_FOR_FUNCTION}; + throw Exception{"Number of arguments for function " + getName() + " doesn't match: passed " + + toString(arguments.size()) + ", should be at least 2.", ErrorCodes::TOO_LESS_ARGUMENTS_FOR_FUNCTION}; const auto first_arg = arguments.front().get(); if (!first_arg->isInteger()) - throw Exception{ - "Illegal type " + first_arg->getName() + " of first argument of function " + getName(), - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + throw Exception{"Illegal type " + first_arg->getName() + " of first argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; for (const auto i : ext::range(1, arguments.size())) @@ -1132,9 +1128,7 @@ public: const auto pos_arg = arguments[i].get(); if (!pos_arg->isUnsignedInteger()) - throw Exception{ - "Illegal type " + pos_arg->getName() + " of " + toString(i) + " argument of function " + getName(), - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + throw Exception{"Illegal type " + pos_arg->getName() + " of " + toString(i) + " argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; } return std::make_shared(); @@ -1152,9 +1146,7 @@ public: && !execute(block, arguments, result, value_col) && !execute(block, arguments, result, value_col) && !execute(block, arguments, result, value_col)) - throw Exception{ - "Illegal column " + value_col->getName() + " of argument of function " + getName(), - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Illegal column " + value_col->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } private: @@ -1255,9 +1247,7 @@ private: && !addToMaskImpl(mask, pos_col) && !addToMaskImpl(mask, pos_col) && !addToMaskImpl(mask, pos_col)) - throw Exception{ - "Illegal column " + pos_col->getName() + " of argument of function " + getName(), - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Illegal column " + pos_col->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } return mask; diff --git a/dbms/src/Functions/FunctionsArray.cpp b/dbms/src/Functions/FunctionsArray.cpp index e61b22b5acc..bdab0ddc3b6 100644 --- a/dbms/src/Functions/FunctionsArray.cpp +++ b/dbms/src/Functions/FunctionsArray.cpp @@ -1962,8 +1962,7 @@ DataTypePtr FunctionRange::getReturnTypeImpl(const DataTypes & arguments) const const DataTypePtr & arg = arguments.front(); if (!arg->isUnsignedInteger()) - throw Exception{ - "Illegal type " + arg->getName() + " of argument of function " + getName(), + throw Exception{"Illegal type " + arg->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; return std::make_shared(arg); @@ -1982,17 +1981,15 @@ bool FunctionRange::executeInternal(Block & block, const IColumn * arg, const si { const auto sum = lhs + rhs; if (sum < lhs) - throw Exception{ - "A call to function " + getName() + " overflows, investigate the values of arguments you are passing", + throw Exception{"A call to function " + getName() + " overflows, investigate the values of arguments you are passing", ErrorCodes::ARGUMENT_OUT_OF_BOUND}; return sum; }); if (total_values > max_elements) - throw Exception{ - "A call to function " + getName() + " would produce " + std::to_string(total_values) + - " array elements, which is greater than the allowed maximum of " + std::to_string(max_elements), + throw Exception{"A call to function " + getName() + " would produce " + std::to_string(total_values) + + " array elements, which is greater than the allowed maximum of " + std::to_string(max_elements), ErrorCodes::ARGUMENT_OUT_OF_BOUND}; auto data_col = ColumnVector::create(total_values); @@ -2027,9 +2024,7 @@ void FunctionRange::executeImpl(Block & block, const ColumnNumbers & arguments, !executeInternal(block, col, result) && !executeInternal(block, col, result)) { - throw Exception{ - "Illegal column " + col->getName() + " of argument of function " + getName(), - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Illegal column " + col->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } } diff --git a/dbms/src/Functions/FunctionsArray.h b/dbms/src/Functions/FunctionsArray.h index ff6c1d79dad..865864fb890 100644 --- a/dbms/src/Functions/FunctionsArray.h +++ b/dbms/src/Functions/FunctionsArray.h @@ -1166,10 +1166,8 @@ private: || executeConst(block, arguments, result) || executeString(block, arguments, result) || executeGeneric(block, arguments, result))) - throw Exception{ - "Illegal column " + block.getByPosition(arguments[0]).column->getName() - + " of first argument of function " + getName(), - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Illegal column " + block.getByPosition(arguments[0]).column->getName() + + " of first argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } }; diff --git a/dbms/src/Functions/FunctionsComparison.h b/dbms/src/Functions/FunctionsComparison.h index 0aac1c13f82..0cf19833821 100644 --- a/dbms/src/Functions/FunctionsComparison.h +++ b/dbms/src/Functions/FunctionsComparison.h @@ -779,10 +779,8 @@ private: const auto column_string = checkAndGetColumnConst(column_string_untyped); if (!column_string || !legal_types) - throw Exception{ - "Illegal columns " + col_left_untyped->getName() + " and " + col_right_untyped->getName() - + " of arguments of function " + getName(), - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Illegal columns " + col_left_untyped->getName() + " and " + col_right_untyped->getName() + + " of arguments of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; StringRef string_value = column_string->getDataAt(0); diff --git a/dbms/src/Functions/FunctionsConversion.h b/dbms/src/Functions/FunctionsConversion.h index 48296002088..5a284f4c435 100644 --- a/dbms/src/Functions/FunctionsConversion.h +++ b/dbms/src/Functions/FunctionsConversion.h @@ -942,9 +942,7 @@ public: { const auto src_n = column_fixed_string->getN(); if (src_n > n) - throw Exception{ - "String too long for type FixedString(" + toString(n) + ")", - ErrorCodes::TOO_LARGE_STRING_SIZE}; + throw Exception{"String too long for type FixedString(" + toString(n) + ")", ErrorCodes::TOO_LARGE_STRING_SIZE}; auto column_fixed = ColumnFixedString::create(n); diff --git a/dbms/src/Functions/FunctionsDateTime.h b/dbms/src/Functions/FunctionsDateTime.h index a44c5dda122..9bf68024584 100644 --- a/dbms/src/Functions/FunctionsDateTime.h +++ b/dbms/src/Functions/FunctionsDateTime.h @@ -638,20 +638,19 @@ public: if (arguments.size() == 1) { if (!arguments[0].type->isDateOrDateTime()) - throw Exception{ - "Illegal type " + arguments[0].type->getName() + " of argument of function " + getName() + - ". Should be a date or a date with time", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + throw Exception("Illegal type " + arguments[0].type->getName() + " of argument of function " + getName() + + ". Should be a date or a date with time", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); } else if (arguments.size() == 2) { if (!checkDataType(arguments[0].type.get()) || !checkDataType(arguments[1].type.get())) - throw Exception{ + throw Exception( "Function " + getName() + " supports 1 or 2 arguments. The 1st argument " "must be of type Date or DateTime. The 2nd argument (optional) must be " "a constant string with timezone name. The timezone argument is allowed " "only when the 1st argument has the type DateTime", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); } else throw Exception("Number of arguments for function " + getName() + " doesn't match: passed " @@ -953,21 +952,20 @@ public: if (arguments.size() == 2) { if (!arguments[0].type->isDateOrDateTime()) - throw Exception{ - "Illegal type " + arguments[0].type->getName() + " of argument of function " + getName() + + throw Exception{"Illegal type " + arguments[0].type->getName() + " of argument of function " + getName() + ". Should be a date or a date with time", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; } else { if (!checkDataType(arguments[0].type.get()) || !checkDataType(arguments[2].type.get())) - throw Exception{ + throw Exception( "Function " + getName() + " supports 2 or 3 arguments. The 1st argument " "must be of type Date or DateTime. The 2nd argument must be number. " "The 3rd argument (optional) must be " "a constant string with timezone name. The timezone argument is allowed " "only when the 1st argument has the type DateTime", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); } if (checkDataType(arguments[0].type.get())) @@ -1299,8 +1297,7 @@ public: ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); if (!checkDataType(arguments[0].type.get())) - throw Exception{ - "Illegal type " + arguments[0].type->getName() + " of argument of function " + getName() + + throw Exception{"Illegal type " + arguments[0].type->getName() + " of argument of function " + getName() + ". Should be DateTime", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; String time_zone_name = extractTimeZoneNameFromFunctionArguments(arguments, 1, 0); diff --git a/dbms/src/Functions/FunctionsHashing.h b/dbms/src/Functions/FunctionsHashing.h index 39184e4dbfc..89b2d7f8861 100644 --- a/dbms/src/Functions/FunctionsHashing.h +++ b/dbms/src/Functions/FunctionsHashing.h @@ -702,24 +702,18 @@ public: { const auto arg_count = arguments.size(); if (arg_count != 1 && arg_count != 2) - throw Exception{ - "Number of arguments for function " + getName() + " doesn't match: passed " + - toString(arg_count) + ", should be 1 or 2.", - ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH}; + throw Exception{"Number of arguments for function " + getName() + " doesn't match: passed " + + toString(arg_count) + ", should be 1 or 2.", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH}; const auto first_arg = arguments.front().get(); if (!checkDataType(first_arg)) - throw Exception{ - "Illegal type " + first_arg->getName() + " of argument of function " + getName(), - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + throw Exception{"Illegal type " + first_arg->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; if (arg_count == 2) { const auto second_arg = arguments.back().get(); if (!second_arg->isInteger()) - throw Exception{ - "Illegal type " + second_arg->getName() + " of argument of function " + getName(), - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + throw Exception{"Illegal type " + second_arg->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; } return std::make_shared(); @@ -762,19 +756,15 @@ private: block.getByPosition(result).column = std::move(col_to); } else - throw Exception{ - "Illegal column " + block.getByPosition(arguments[0]).column->getName() + - " of argument of function " + getName(), - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Illegal column " + block.getByPosition(arguments[0]).column->getName() + + " of argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } void executeTwoArgs(Block & block, const ColumnNumbers & arguments, const size_t result) const { const auto level_col = block.getByPosition(arguments.back()).column.get(); if (!level_col->isColumnConst()) - throw Exception{ - "Second argument of function " + getName() + " must be an integral constant", - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Second argument of function " + getName() + " must be an integral constant", ErrorCodes::ILLEGAL_COLUMN}; const auto level = level_col->get64(0); @@ -796,10 +786,8 @@ private: block.getByPosition(result).column = std::move(col_to); } else - throw Exception{ - "Illegal column " + block.getByPosition(arguments[0]).column->getName() + - " of argument of function " + getName(), - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Illegal column " + block.getByPosition(arguments[0]).column->getName() + + " of argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } }; diff --git a/dbms/src/Functions/FunctionsMath.h b/dbms/src/Functions/FunctionsMath.h index 5b178c6cd42..c12ed5ef436 100644 --- a/dbms/src/Functions/FunctionsMath.h +++ b/dbms/src/Functions/FunctionsMath.h @@ -79,9 +79,7 @@ private: DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override { if (!arguments.front()->isNumber()) - throw Exception{ - "Illegal type " + arguments.front()->getName() + " of argument of function " + getName(), - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + throw Exception{"Illegal type " + arguments.front()->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; return std::make_shared(); } @@ -140,9 +138,7 @@ private: !execute(block, arg, result) && !execute(block, arg, result)) { - throw Exception{ - "Illegal column " + arg->getName() + " of argument of function " + getName(), - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Illegal column " + arg->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } } }; @@ -204,8 +200,7 @@ private: const auto check_argument_type = [this] (const IDataType * arg) { if (!arg->isNumber()) - throw Exception{ - "Illegal type " + arg->getName() + " of argument of function " + getName(), + throw Exception{"Illegal type " + arg->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; }; @@ -352,8 +347,7 @@ private: } else { - throw Exception{ - "Illegal column " + block.getByPosition(arguments[1]).column->getName() + + throw Exception{"Illegal column " + block.getByPosition(arguments[1]).column->getName() + " of second argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } @@ -377,8 +371,7 @@ private: } else { - throw Exception{ - "Illegal column " + block.getByPosition(arguments[1]).column->getName() + + throw Exception{"Illegal column " + block.getByPosition(arguments[1]).column->getName() + " of second argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } @@ -402,8 +395,7 @@ private: !executeLeft(block, arguments, result, left_arg) && !executeLeft(block, arguments, result, left_arg)) { - throw Exception{ - "Illegal column " + left_arg->getName() + " of argument of function " + getName(), + throw Exception{"Illegal column " + left_arg->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } } @@ -484,7 +476,7 @@ using FunctionExp = FunctionMathUnaryFloat64>; using FunctionExp2 = FunctionMathUnaryFloat64>; using FunctionLog2 = FunctionMathUnaryFloat64>; -using FunctionExp10 = FunctionMathUnaryFloat64isStringOrFixedString()) - throw Exception{ - "Illegal type " + arg->getName() + " of argument " + std::to_string(arg_idx + 1) + " of function " + getName(), + throw Exception{"Illegal type " + arg->getName() + " of argument " + std::to_string(arg_idx + 1) + " of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; } @@ -1017,12 +1016,10 @@ private: DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override { if (!arguments[0]->isString()) - throw Exception{ - "Illegal type " + arguments[0]->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + throw Exception{"Illegal type " + arguments[0]->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; if (!arguments[1]->isString()) - throw Exception{ - "Illegal type " + arguments[1]->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; + throw Exception{"Illegal type " + arguments[1]->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; return std::make_shared(); } @@ -1081,8 +1078,7 @@ private: block.getByPosition(result).column = std::move(col_res); } else - throw Exception{ - "Illegal column " + block.getByPosition(arguments[0]).column->getName() + " of argument of function " + getName(), + throw Exception{"Illegal column " + block.getByPosition(arguments[0]).column->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } }; diff --git a/dbms/src/Functions/FunctionsTransform.h b/dbms/src/Functions/FunctionsTransform.h index 68b7c023064..bf604ea488b 100644 --- a/dbms/src/Functions/FunctionsTransform.h +++ b/dbms/src/Functions/FunctionsTransform.h @@ -72,9 +72,7 @@ public: { const auto args_size = arguments.size(); if (args_size != 3 && args_size != 4) - throw Exception{ - "Number of arguments for function " + getName() + " doesn't match: passed " + - toString(args_size) + ", should be 3 or 4", + throw Exception{"Number of arguments for function " + getName() + " doesn't match: passed " + toString(args_size) + ", should be 3 or 4", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH}; const DataTypePtr & type_x = arguments[0]; @@ -180,9 +178,7 @@ public: && !executeNum(in, out, default_column) && !executeString(in, out, default_column)) { - throw Exception{ - "Illegal column " + in->getName() + " of first argument of function " + getName(), - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Illegal column " + in->getName() + " of first argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } block.getByPosition(result).column = std::move(column_result); @@ -246,8 +242,7 @@ private: && !executeNumToNumWithConstDefault(in, out_untyped) && !executeNumToStringWithConstDefault(in, out_untyped)) { - throw Exception{ - "Illegal column " + in->getName() + " of elements of array of second argument of function " + getName(), + throw Exception{"Illegal column " + in->getName() + " of elements of array of second argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } } @@ -265,8 +260,7 @@ private: && !executeNumToNumWithNonConstDefault(in, out_untyped, default_untyped) && !executeNumToStringWithNonConstDefault(in, out_untyped, default_untyped)) { - throw Exception{ - "Illegal column " + in->getName() + " of elements of array of second argument of function " + getName(), + throw Exception{"Illegal column " + in->getName() + " of elements of array of second argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } } @@ -284,11 +278,8 @@ private: if (!default_untyped) { if (!executeStringToString(in, out_untyped)) - { - throw Exception{ - "Illegal column " + in->getName() + " of elements of array of second argument of function " + getName(), + throw Exception{"Illegal column " + in->getName() + " of elements of array of second argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; - } } else if (default_untyped->isColumnConst()) { @@ -304,8 +295,7 @@ private: && !executeStringToNumWithConstDefault(in, out_untyped) && !executeStringToStringWithConstDefault(in, out_untyped)) { - throw Exception{ - "Illegal column " + in->getName() + " of elements of array of second argument of function " + getName(), + throw Exception{"Illegal column " + in->getName() + " of elements of array of second argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } } @@ -323,8 +313,7 @@ private: && !executeStringToNumWithNonConstDefault(in, out_untyped, default_untyped) && !executeStringToStringWithNonConstDefault(in, out_untyped, default_untyped)) { - throw Exception{ - "Illegal column " + in->getName() + " of elements of array of second argument of function " + getName(), + throw Exception{"Illegal column " + in->getName() + " of elements of array of second argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN}; } } diff --git a/dbms/src/Functions/registerFunctions_area.cpp.in b/dbms/src/Functions/registerFunctions_area.cpp.in index bf7c0407675..cd727885d57 100644 --- a/dbms/src/Functions/registerFunctions_area.cpp.in +++ b/dbms/src/Functions/registerFunctions_area.cpp.in @@ -8,9 +8,7 @@ namespace DB void registerFunctions@FUNCTION_AREA@(FunctionFactory & factory) { - @REGISTER_FUNCTIONS@ - } } diff --git a/dbms/src/IO/ReadBufferAIO.cpp b/dbms/src/IO/ReadBufferAIO.cpp index b9f760b51da..1c4b7ab49e3 100644 --- a/dbms/src/IO/ReadBufferAIO.cpp +++ b/dbms/src/IO/ReadBufferAIO.cpp @@ -85,8 +85,8 @@ void ReadBufferAIO::setMaxBytes(size_t max_bytes_read_) bool ReadBufferAIO::nextImpl() { - /// If the end of the file has already been reached by calling this function, - /// then the current call is wrong. + /// If the end of the file has already been reached by calling this function, + /// then the current call is wrong. if (is_eof) return false; diff --git a/dbms/src/Interpreters/IExternalLoaderConfigRepository.h b/dbms/src/Interpreters/IExternalLoaderConfigRepository.h index 93159eb4ba6..79615780242 100644 --- a/dbms/src/Interpreters/IExternalLoaderConfigRepository.h +++ b/dbms/src/Interpreters/IExternalLoaderConfigRepository.h @@ -12,7 +12,7 @@ namespace DB /** Repository with configurations of user-defined objects (dictionaries, models). * Used by ExternalLoader. - */ + */ class IExternalLoaderConfigRepository { public: diff --git a/dbms/src/Interpreters/InterpreterCreateQuery.cpp b/dbms/src/Interpreters/InterpreterCreateQuery.cpp index 9b4deee75e1..0b4caa95157 100644 --- a/dbms/src/Interpreters/InterpreterCreateQuery.cpp +++ b/dbms/src/Interpreters/InterpreterCreateQuery.cpp @@ -522,7 +522,7 @@ BlockIO InterpreterCreateQuery::createTable(ASTCreateQuery & create) } else if (context.tryGetExternalTable(table_name) && create.if_not_exists) return {}; - + res = StorageFactory::instance().get(create, data_path, table_name, diff --git a/dbms/src/Interpreters/PartLog.cpp b/dbms/src/Interpreters/PartLog.cpp index 646aae527b1..dc5d5e07a41 100644 --- a/dbms/src/Interpreters/PartLog.cpp +++ b/dbms/src/Interpreters/PartLog.cpp @@ -49,7 +49,7 @@ Block PartLogElement::createBlock() /// Is there an error during the execution or commit {ColumnUInt16::create(), std::make_shared(), "error"}, {ColumnString::create(), std::make_shared(), "exception"}, - }; + }; } void PartLogElement::appendToBlock(Block & block) const diff --git a/dbms/src/Interpreters/SettingsCommon.h b/dbms/src/Interpreters/SettingsCommon.h index 8b53484ce51..9b1e9cb1ee2 100644 --- a/dbms/src/Interpreters/SettingsCommon.h +++ b/dbms/src/Interpreters/SettingsCommon.h @@ -730,7 +730,8 @@ public: return String(1, value); } - void set(char x) { + void set(char x) + { value = x; changed = true; } diff --git a/dbms/src/Parsers/iostream_debug_helpers.cpp b/dbms/src/Parsers/iostream_debug_helpers.cpp index ee5d7d5d781..61dd08ecddc 100644 --- a/dbms/src/Parsers/iostream_debug_helpers.cpp +++ b/dbms/src/Parsers/iostream_debug_helpers.cpp @@ -6,13 +6,14 @@ namespace DB { - -std::ostream & operator<<(std::ostream & stream, const Token & what) { +std::ostream & operator<<(std::ostream & stream, const Token & what) +{ stream << "Token (type="<< static_cast(what.type) <<"){"<< std::string{what.begin, what.end} << "}"; return stream; } -std::ostream & operator<<(std::ostream & stream, const Expected & what) { +std::ostream & operator<<(std::ostream & stream, const Expected & what) +{ stream << "Expected {variants="; dumpValue(stream, what.variants) << "; max_parsed_pos=" << what.max_parsed_pos << "}"; diff --git a/dbms/src/Server/HTTPHandler.h b/dbms/src/Server/HTTPHandler.h index 72606afa827..58cb6bb67f1 100644 --- a/dbms/src/Server/HTTPHandler.h +++ b/dbms/src/Server/HTTPHandler.h @@ -55,7 +55,7 @@ private: IServer & server; Poco::Logger * log; - /// It is the name of the server that will be sent in an http-header X-ClickHouse-Server-Display-Name. + /// It is the name of the server that will be sent in an http-header X-ClickHouse-Server-Display-Name. String server_display_name; CurrentMetrics::Increment metric_increment{CurrentMetrics::HTTPConnection}; diff --git a/dbms/src/Server/Server.cpp b/dbms/src/Server/Server.cpp index 19a9809db7c..d8e5870f8e6 100644 --- a/dbms/src/Server/Server.cpp +++ b/dbms/src/Server/Server.cpp @@ -259,7 +259,8 @@ int Server::main(const std::vector & /*args*/) /* already_loaded = */ false); /// Reload config in SYSTEM RELOAD CONFIG query. - global_context->setConfigReloadCallback([&]() { + global_context->setConfigReloadCallback([&]() + { main_config_reloader->reload(); users_config_reloader->reload(); }); diff --git a/dbms/src/Server/TCPHandler.h b/dbms/src/Server/TCPHandler.h index 7202067dab8..e01987d3bbd 100644 --- a/dbms/src/Server/TCPHandler.h +++ b/dbms/src/Server/TCPHandler.h @@ -117,8 +117,8 @@ private: QueryState state; CurrentMetrics::Increment metric_increment{CurrentMetrics::TCPConnection}; - - /// It is the name of the server that will be sent to the client. + + /// It is the name of the server that will be sent to the client. String server_display_name; void runImpl(); diff --git a/dbms/src/Storages/AlterCommands.cpp b/dbms/src/Storages/AlterCommands.cpp index 274f9315f5f..f30dc9df53a 100644 --- a/dbms/src/Storages/AlterCommands.cpp +++ b/dbms/src/Storages/AlterCommands.cpp @@ -26,11 +26,7 @@ void AlterCommand::apply(ColumnsDescription & columns_description) const if (type == ADD_COLUMN) { if (columns_description.getAll().contains(column_name)) - { - throw Exception{ - "Cannot add column " + column_name + ": column with this name already exists", - ErrorCodes::ILLEGAL_COLUMN}; - } + throw Exception{"Cannot add column " + column_name + ": column with this name already exists", ErrorCodes::ILLEGAL_COLUMN}; const auto add_column = [this] (NamesAndTypesList & columns) { @@ -196,17 +192,13 @@ void AlterCommands::validate(IStorage * table, const Context & context) if (command.type == AlterCommand::ADD_COLUMN) { if (std::end(all_columns) != column_it) - throw Exception{ - "Cannot add column " + column_name + ": column with this name already exists", - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Cannot add column " + column_name + ": column with this name already exists", ErrorCodes::ILLEGAL_COLUMN}; } else if (command.type == AlterCommand::MODIFY_COLUMN) { if (std::end(all_columns) == column_it) - throw Exception{ - "Wrong column name. Cannot find column " + column_name + " to modify", - ErrorCodes::ILLEGAL_COLUMN}; + throw Exception{"Wrong column name. Cannot find column " + column_name + " to modify", ErrorCodes::ILLEGAL_COLUMN}; all_columns.erase(column_it); defaults.erase(column_name); diff --git a/dbms/src/Storages/Distributed/DirectoryMonitor.cpp b/dbms/src/Storages/Distributed/DirectoryMonitor.cpp index 19981be3f06..1c1e1f83033 100644 --- a/dbms/src/Storages/Distributed/DirectoryMonitor.cpp +++ b/dbms/src/Storages/Distributed/DirectoryMonitor.cpp @@ -63,16 +63,13 @@ namespace const char * user_pw_end = strchr(address.data(), '@'); const char * colon = strchr(address.data(), ':'); if (!user_pw_end || !colon) - throw Exception{ - "Shard address '" + address + "' does not match to 'user[:password]@host:port#default_database' pattern", + throw Exception{"Shard address '" + address + "' does not match to 'user[:password]@host:port#default_database' pattern", ErrorCodes::INCORRECT_FILE_NAME}; const bool has_pw = colon < user_pw_end; const char * host_end = has_pw ? strchr(user_pw_end + 1, ':') : colon; if (!host_end) - throw Exception{ - "Shard address '" + address + "' does not contain port", - ErrorCodes::INCORRECT_FILE_NAME}; + throw Exception{"Shard address '" + address + "' does not contain port", ErrorCodes::INCORRECT_FILE_NAME}; const char * has_db = strchr(address.data(), '#'); const char * port_end = has_db ? has_db : address_end; diff --git a/dbms/src/Storages/Distributed/DistributedBlockOutputStream.h b/dbms/src/Storages/Distributed/DistributedBlockOutputStream.h index b08a21bbc07..6b3349eb16d 100644 --- a/dbms/src/Storages/Distributed/DistributedBlockOutputStream.h +++ b/dbms/src/Storages/Distributed/DistributedBlockOutputStream.h @@ -128,7 +128,7 @@ private: size_t remote_jobs_count = 0; size_t local_jobs_count = 0; - + std::atomic finished_jobs_count{0}; Poco::Logger * log; diff --git a/dbms/src/Storages/MergeTree/MergeTreeData.cpp b/dbms/src/Storages/MergeTree/MergeTreeData.cpp index 8acdd4584b8..20d6aa545c7 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeData.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeData.cpp @@ -774,10 +774,7 @@ void MergeTreeData::clearOldPartsFromFilesystem() void MergeTreeData::setPath(const String & new_full_path) { if (Poco::File{new_full_path}.exists()) - throw Exception{ - "Target path already exists: " + new_full_path, - /// @todo existing target can also be a file, not directory - ErrorCodes::DIRECTORY_ALREADY_EXISTS}; + throw Exception{"Target path already exists: " + new_full_path, ErrorCodes::DIRECTORY_ALREADY_EXISTS}; Poco::File(full_path).renameTo(new_full_path); diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataWriter.h b/dbms/src/Storages/MergeTree/MergeTreeDataWriter.h index 021e5a7eea8..93d8ecb98ae 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataWriter.h +++ b/dbms/src/Storages/MergeTree/MergeTreeDataWriter.h @@ -30,7 +30,7 @@ struct BlockWithPartition using BlocksWithPartition = std::vector; - /** Writes new parts of data to the merge tree. +/** Writes new parts of data to the merge tree. */ class MergeTreeDataWriter { diff --git a/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp b/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp index 6c9409be833..e99609b0c09 100644 --- a/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp +++ b/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp @@ -260,7 +260,7 @@ std::string MergedBlockOutputStream::getPartPath() const return part_path; } - /// If data is pre-sorted. +/// If data is pre-sorted. void MergedBlockOutputStream::write(const Block & block) { writeImpl(block, nullptr); diff --git a/dbms/src/Storages/MergeTree/registerStorageMergeTree.cpp b/dbms/src/Storages/MergeTree/registerStorageMergeTree.cpp index 4cdff05c2e3..a875b743760 100644 --- a/dbms/src/Storages/MergeTree/registerStorageMergeTree.cpp +++ b/dbms/src/Storages/MergeTree/registerStorageMergeTree.cpp @@ -233,7 +233,7 @@ Date column must exist in the table and have type Date (not DateTime). It is used for internal data partitioning and works like some kind of index. If your source data doesn't have a column of type Date, but has a DateTime column, you may add values for Date column while loading, - or you may INSERT your source data to a table of type Log and then transform it with INSERT INTO t SELECT toDate(time) AS date, * FROM ... + or you may INSERT your source data to a table of type Log and then transform it with INSERT INTO t SELECT toDate(time) AS date, * FROM ... If your source data doesn't have any date or time, you may just pass any constant for a date column while loading. Next parameter is optional sampling expression. Sampling expression is used to implement SAMPLE clause in query for approximate query execution. diff --git a/dbms/src/Storages/StorageJoin.cpp b/dbms/src/Storages/StorageJoin.cpp index aab48c3ed2a..e17129610d3 100644 --- a/dbms/src/Storages/StorageJoin.cpp +++ b/dbms/src/Storages/StorageJoin.cpp @@ -30,9 +30,7 @@ StorageJoin::StorageJoin( { for (const auto & key : key_names) if (!getColumns().hasPhysical(key)) - throw Exception{ - "Key column (" + key + ") does not exist in table declaration.", - ErrorCodes::NO_SUCH_COLUMN_IN_TABLE}; + throw Exception{"Key column (" + key + ") does not exist in table declaration.", ErrorCodes::NO_SUCH_COLUMN_IN_TABLE}; /// NOTE StorageJoin doesn't use join_use_nulls setting. diff --git a/dbms/src/Storages/tests/merge_selector2.cpp b/dbms/src/Storages/tests/merge_selector2.cpp index 7eb7e1f4f0b..a2c30733326 100644 --- a/dbms/src/Storages/tests/merge_selector2.cpp +++ b/dbms/src/Storages/tests/merge_selector2.cpp @@ -10,9 +10,9 @@ /** This program tests merge-selecting algorithm. * Usage: clickhouse-client --query=" - SELECT bytes, now() - modification_time, level, name - FROM system.parts - WHERE table = 'visits' AND active AND partition = '201610'" | ./merge_selector2 + SELECT bytes, now() - modification_time, level, name + FROM system.parts + WHERE table = 'visits' AND active AND partition = '201610'" | ./merge_selector2 */ int main(int, char **)