From 1c9cff551e4b9fe3e221cb5f7a12dcc01ff9ed90 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 9 Aug 2023 02:58:12 +0200 Subject: [PATCH] Continue on garbage removal --- base/base/EnumReflection.h | 1 + src/Common/LoggingFormatStringHelpers.h | 3 +++ .../NamedCollections/NamedCollectionConfiguration.cpp | 2 ++ src/Core/Field.cpp | 8 ++++++++ src/Core/Field.h | 5 ++--- src/Core/SettingsFields.h | 2 ++ src/IO/S3/Credentials.cpp | 10 ++++++---- 7 files changed, 24 insertions(+), 7 deletions(-) diff --git a/base/base/EnumReflection.h b/base/base/EnumReflection.h index 0d1f8ae0a40..e3208f16a75 100644 --- a/base/base/EnumReflection.h +++ b/base/base/EnumReflection.h @@ -3,6 +3,7 @@ #include #include + template concept is_enum = std::is_enum_v; namespace detail diff --git a/src/Common/LoggingFormatStringHelpers.h b/src/Common/LoggingFormatStringHelpers.h index 6dffd202807..06320509c17 100644 --- a/src/Common/LoggingFormatStringHelpers.h +++ b/src/Common/LoggingFormatStringHelpers.h @@ -1,4 +1,5 @@ #pragma once + #include #include #include @@ -6,6 +7,8 @@ #include #include #include +#include + struct PreformattedMessage; consteval void formatStringCheckArgsNumImpl(std::string_view str, size_t nargs); diff --git a/src/Common/NamedCollections/NamedCollectionConfiguration.cpp b/src/Common/NamedCollections/NamedCollectionConfiguration.cpp index 1c42b001ceb..d9bf2349a5a 100644 --- a/src/Common/NamedCollections/NamedCollectionConfiguration.cpp +++ b/src/Common/NamedCollections/NamedCollectionConfiguration.cpp @@ -3,6 +3,8 @@ #include #include #include +#include + namespace DB { diff --git a/src/Core/Field.cpp b/src/Core/Field.cpp index 90dcb2e5f8e..89faaed8a72 100644 --- a/src/Core/Field.cpp +++ b/src/Core/Field.cpp @@ -9,16 +9,24 @@ #include #include #include +#include namespace DB { + namespace ErrorCodes { extern const int CANNOT_RESTORE_FROM_FIELD_DUMP; extern const int DECIMAL_OVERFLOW; } +/// Keep in mind, that "magic_enum" is very expensive for compiler. +std::string_view Field::getTypeName() const +{ + return magic_enum::enum_name(which); +} + inline Field getBinaryValue(UInt8 type, ReadBuffer & buf) { switch (type) diff --git a/src/Core/Field.h b/src/Core/Field.h index ef1bd9a895d..6666e66e8d5 100644 --- a/src/Core/Field.h +++ b/src/Core/Field.h @@ -15,8 +15,7 @@ #include #include #include -#include -#include + namespace DB { @@ -449,7 +448,7 @@ public: Types::Which getType() const { return which; } - constexpr std::string_view getTypeName() const { return magic_enum::enum_name(which); } + std::string_view getTypeName() const; bool isNull() const { return which == Types::Null; } template diff --git a/src/Core/SettingsFields.h b/src/Core/SettingsFields.h index 32fffd3af06..db14f91512f 100644 --- a/src/Core/SettingsFields.h +++ b/src/Core/SettingsFields.h @@ -10,6 +10,8 @@ #include #include #include +#include + namespace DB { diff --git a/src/IO/S3/Credentials.cpp b/src/IO/S3/Credentials.cpp index 84550d3f7c5..d59bc4fd115 100644 --- a/src/IO/S3/Credentials.cpp +++ b/src/IO/S3/Credentials.cpp @@ -14,26 +14,26 @@ # include # include -# include # include -# include # include +# include namespace DB { + namespace ErrorCodes { extern const int AWS_ERROR; } -} -namespace DB::S3 +namespace S3 { namespace { + bool areCredentialsEmptyOrExpired(const Aws::Auth::AWSCredentials & credentials, uint64_t expiration_window_seconds) { if (credentials.IsEmpty()) @@ -569,4 +569,6 @@ S3CredentialsProviderChain::S3CredentialsProviderChain( } +} + #endif