diff --git a/src/Dictionaries/CacheDictionary.cpp b/src/Dictionaries/CacheDictionary.cpp index c7ce0754823..1c4ee3dc83b 100644 --- a/src/Dictionaries/CacheDictionary.cpp +++ b/src/Dictionaries/CacheDictionary.cpp @@ -376,7 +376,6 @@ size_t CacheDictionary::findCellIdxForSet(const Key & id) const void CacheDictionary::has(const PaddedPODArray & ids, PaddedPODArray & out) const { - std::cout << "has" << std::endl; /// There are three types of ids. /// - Valid ids. These ids are presented in local cache and their lifetime is not expired. /// - CacheExpired ids. Ids that are in local cache, but their values are rotted (lifetime is expired). @@ -509,18 +508,21 @@ void CacheDictionary::createAttributes() } } -CacheDictionary::Attribute CacheDictionary::createAttributeWithTypeAndName(const AttributeUnderlyingType type, const String & name, const Field & null_value) +CacheDictionary::Attribute CacheDictionary::createAttributeWithTypeAndName(const AttributeUnderlyingType type, const String & name, const Field & null_value) /* NOLINT(readability-convert-member-functions-to-static) */ { Attribute attr{type, name, {}, {}}; switch (type) { + + /* Macro argument should be enclosed in parentheses, but if do so we cannot initialize \ + * NearestFieldType which takes TYPE as a template parameter. */ #define DISPATCH(TYPE)\ - case AttributeUnderlyingType::ut##TYPE:\ - attr.null_value = TYPE(null_value.get>());\ - attr.arrays = std::make_unique>(size);\ + case AttributeUnderlyingType::ut##TYPE: {\ + attr.null_value = TYPE(null_value.get>()); /* NOLINT(bugprone-macro-parentheses) */ \ + attr.arrays = std::make_unique>(size); /* NOLINT(bugprone-macro-parentheses) */ \ bytes_allocated += size * sizeof(TYPE);\ - break; + break;} DISPATCH(UInt8) DISPATCH(UInt16) DISPATCH(UInt32) @@ -536,13 +538,14 @@ CacheDictionary::Attribute CacheDictionary::createAttributeWithTypeAndName(const DISPATCH(Float32) DISPATCH(Float64) #undef DISPATCH - case AttributeUnderlyingType::utString: + case AttributeUnderlyingType::utString: { attr.null_value = null_value.get(); attr.arrays = std::make_unique>(size); bytes_allocated += size * sizeof(StringRef); if (!string_arena) string_arena = std::make_unique(); break; + } } return attr; @@ -552,9 +555,11 @@ void CacheDictionary::setDefaultAttributeValue(Attribute & attribute, const Key { switch (attribute.type) { + /* Macro argument should be enclosed in parentheses, but if do so we cannot initialize \ + * NearestFieldType which takes TYPE as a template parameter. */ #define DISPATCH(TYPE)\ case AttributeUnderlyingType::ut##TYPE:\ - std::get>(attribute.arrays)[idx] = std::get(attribute.null_value);\ + std::get>(attribute.arrays)[idx] = std::get(attribute.null_value); /* NOLINT(bugprone-macro-parentheses) */ \ break; DISPATCH(UInt8) DISPATCH(UInt16) diff --git a/src/Dictionaries/CacheDictionary.h b/src/Dictionaries/CacheDictionary.h index 62c858194e0..8e805e39fe6 100644 --- a/src/Dictionaries/CacheDictionary.h +++ b/src/Dictionaries/CacheDictionary.h @@ -257,7 +257,7 @@ private: void createAttributes(); - Attribute createAttributeWithTypeAndName(const AttributeUnderlyingType type, const String & name, const Field & null_value); + Attribute createAttributeWithTypeAndName(const AttributeUnderlyingType type, const String & name, const Field & null_value); /* NOLINT(readability-convert-member-functions-to-static) */ template void getItemsNumberImpl( diff --git a/utils/zookeeper-dump-tree/main.cpp b/utils/zookeeper-dump-tree/main.cpp index b50d6e97235..5ab7bc2d536 100644 --- a/utils/zookeeper-dump-tree/main.cpp +++ b/utils/zookeeper-dump-tree/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char ** argv) size_t num_reconnects = 0; constexpr size_t max_reconnects = 100; - auto ensureSession = [&] + auto ensure_session = [&] { if (zookeeper->expired()) { @@ -70,7 +70,7 @@ int main(int argc, char ** argv) else if (Coordination::isHardwareError(e.code)) { /// Reinitialize the session and move the node to the end of the queue for later retry. - if (!ensureSession()) + if (!ensure_session()) throw; list_futures.emplace_back(it->first, zookeeper->asyncGetChildren(it->first)); continue; @@ -85,7 +85,7 @@ int main(int argc, char ** argv) { std::string child_path = it->first == "/" ? it->first + name : it->first + '/' + name; - ensureSession(); + ensure_session(); list_futures.emplace_back(child_path, zookeeper->asyncGetChildren(child_path)); } }