diff --git a/dbms/src/DataTypes/DataTypeAggregateFunction.cpp b/dbms/src/DataTypes/DataTypeAggregateFunction.cpp index ca43d462d45..3fb380eac0f 100644 --- a/dbms/src/DataTypes/DataTypeAggregateFunction.cpp +++ b/dbms/src/DataTypes/DataTypeAggregateFunction.cpp @@ -338,7 +338,7 @@ bool DataTypeAggregateFunction::equals(const IDataType & rhs) const } -static DataTypePtr create(const String & /*type_name*/, const ASTPtr & arguments) +static DataTypePtr create(const ASTPtr & arguments) { String function_name; AggregateFunctionPtr function; diff --git a/dbms/src/DataTypes/DataTypeArray.cpp b/dbms/src/DataTypes/DataTypeArray.cpp index 9a4c77df9c1..821579732b5 100644 --- a/dbms/src/DataTypes/DataTypeArray.cpp +++ b/dbms/src/DataTypes/DataTypeArray.cpp @@ -509,7 +509,7 @@ size_t DataTypeArray::getNumberOfDimensions() const } -static DataTypePtr create(const String & /*type_name*/, const ASTPtr & arguments) +static DataTypePtr create(const ASTPtr & arguments) { if (!arguments || arguments->children.size() != 1) throw Exception("Array data type family must have exactly one argument - type of elements", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); diff --git a/dbms/src/DataTypes/DataTypeCustomIPv4AndIPv6.cpp b/dbms/src/DataTypes/DataTypeCustomIPv4AndIPv6.cpp index 5c62e060669..4b0ca163383 100644 --- a/dbms/src/DataTypes/DataTypeCustomIPv4AndIPv6.cpp +++ b/dbms/src/DataTypes/DataTypeCustomIPv4AndIPv6.cpp @@ -101,16 +101,16 @@ public: void registerDataTypeDomainIPv4AndIPv6(DataTypeFactory & factory) { - factory.registerSimpleDataTypeCustom("IPv4", [&](const String & /*type_name*/) + factory.registerSimpleDataTypeCustom("IPv4", [] { return std::make_pair(DataTypeFactory::instance().get("UInt32"), std::make_unique(std::make_unique("IPv4"), std::make_unique())); }); - factory.registerSimpleDataTypeCustom("IPv6", [&](const String & /*type_name*/) + factory.registerSimpleDataTypeCustom("IPv6", [] { return std::make_pair(DataTypeFactory::instance().get("FixedString(16)"), - std::make_unique(std::make_unique("IPv6"), std::make_unique())); + std::make_unique(std::make_unique("IPv6"), std::make_unique())); }); } diff --git a/dbms/src/DataTypes/DataTypeCustomSimpleAggregateFunction.cpp b/dbms/src/DataTypes/DataTypeCustomSimpleAggregateFunction.cpp index fecf09f08f7..3072e4a40c1 100644 --- a/dbms/src/DataTypes/DataTypeCustomSimpleAggregateFunction.cpp +++ b/dbms/src/DataTypes/DataTypeCustomSimpleAggregateFunction.cpp @@ -58,7 +58,7 @@ String DataTypeCustomSimpleAggregateFunction::getName() const } -static std::pair create(const String & /*type_name*/, const ASTPtr & arguments) +static std::pair create(const ASTPtr & arguments) { String function_name; AggregateFunctionPtr function; diff --git a/dbms/src/DataTypes/DataTypeDate.cpp b/dbms/src/DataTypes/DataTypeDate.cpp index dd83fbe47b4..2c1dfcbb0fe 100644 --- a/dbms/src/DataTypes/DataTypeDate.cpp +++ b/dbms/src/DataTypes/DataTypeDate.cpp @@ -113,12 +113,7 @@ bool DataTypeDate::equals(const IDataType & rhs) const void registerDataTypeDate(DataTypeFactory & factory) { - const auto & creator = [&](const String & /*type_name*/) - { - return DataTypePtr(std::make_shared()); - }; - - factory.registerSimpleDataType("Date", creator, DataTypeFactory::CaseInsensitive); + factory.registerSimpleDataType("Date", [] { return DataTypePtr(std::make_shared()); }, DataTypeFactory::CaseInsensitive); } } diff --git a/dbms/src/DataTypes/DataTypeDateTime.cpp b/dbms/src/DataTypes/DataTypeDateTime.cpp index 5589a372732..24215f3e590 100644 --- a/dbms/src/DataTypes/DataTypeDateTime.cpp +++ b/dbms/src/DataTypes/DataTypeDateTime.cpp @@ -43,8 +43,8 @@ TimezoneMixin::TimezoneMixin(const String & time_zone_name) utc_time_zone(DateLUT::instance("UTC")) {} -DataTypeDateTime::DataTypeDateTime(const String & time_zone_name, const String & type_name_) - : TimezoneMixin(time_zone_name), type_name(type_name_) +DataTypeDateTime::DataTypeDateTime(const String & time_zone_name) + : TimezoneMixin(time_zone_name) { } @@ -55,10 +55,10 @@ DataTypeDateTime::DataTypeDateTime(const TimezoneMixin & time_zone_) String DataTypeDateTime::doGetName() const { if (!has_explicit_time_zone) - return type_name; + return "DateTime"; WriteBufferFromOwnString out; - out << type_name << "(" << quote << time_zone.getTimeZone() << ")"; + out << "DateTime(" << quote << time_zone.getTimeZone() << ")"; return out.str(); } @@ -194,10 +194,10 @@ namespace ErrorCodes extern const int ILLEGAL_TYPE_OF_ARGUMENT; } -static DataTypePtr create(const String & type_name, const ASTPtr & arguments) +static DataTypePtr create(const ASTPtr & arguments) { if (!arguments) - return std::make_shared("", type_name); + return std::make_shared(); if (arguments->children.size() != 1) throw Exception("DateTime data type can optionally have only one argument - time zone name", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); @@ -206,7 +206,7 @@ static DataTypePtr create(const String & type_name, const ASTPtr & arguments) if (!arg || arg->value.getType() != Field::Types::String) throw Exception("Parameter for DateTime data type must be string literal", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); - return std::make_shared(arg->value.get(), type_name); + return std::make_shared(arg->value.get()); } void registerDataTypeDateTime(DataTypeFactory & factory) diff --git a/dbms/src/DataTypes/DataTypeDateTime.h b/dbms/src/DataTypes/DataTypeDateTime.h index af823eddc0b..47c7f361091 100644 --- a/dbms/src/DataTypes/DataTypeDateTime.h +++ b/dbms/src/DataTypes/DataTypeDateTime.h @@ -49,7 +49,7 @@ protected: class DataTypeDateTime final : public DataTypeNumberBase, public TimezoneMixin { public: - explicit DataTypeDateTime(const String & time_zone_name = "", const String & type_name_ = "DateTime"); + explicit DataTypeDateTime(const String & time_zone_name = ""); explicit DataTypeDateTime(const TimezoneMixin & time_zone); static constexpr auto family_name = "DateTime"; @@ -75,8 +75,6 @@ public: bool canBeInsideNullable() const override { return true; } bool equals(const IDataType & rhs) const override; -private: - const String type_name; }; } diff --git a/dbms/src/DataTypes/DataTypeDateTime64.cpp b/dbms/src/DataTypes/DataTypeDateTime64.cpp index 228cfbd17c8..d790dd60ce4 100644 --- a/dbms/src/DataTypes/DataTypeDateTime64.cpp +++ b/dbms/src/DataTypes/DataTypeDateTime64.cpp @@ -233,7 +233,7 @@ getArgument(const ASTPtr & arguments, size_t argument_index, const char * argume return argument->value.get(); } -static DataTypePtr create64(const String & /*type_name*/, const ASTPtr & arguments) +static DataTypePtr create64(const ASTPtr & arguments) { if (!arguments || arguments->size() == 0) return std::make_shared(DataTypeDateTime64::default_scale); diff --git a/dbms/src/DataTypes/DataTypeDecimalBase.h b/dbms/src/DataTypes/DataTypeDecimalBase.h index e62f593ba79..bb5b0ca4ee8 100644 --- a/dbms/src/DataTypes/DataTypeDecimalBase.h +++ b/dbms/src/DataTypes/DataTypeDecimalBase.h @@ -193,7 +193,7 @@ const DecimalType decimalResultType(const DataTypeNumber &, const DecimalT } template