Style fixes

This commit is contained in:
Maksim Galkin 2024-05-04 22:49:10 +00:00
parent 32f267999d
commit fb6c931262

View File

@ -12,6 +12,7 @@
#include <Columns/ColumnsNumber.h> #include <Columns/ColumnsNumber.h>
#include <Interpreters/castColumn.h> #include <Interpreters/castColumn.h>
#include "Common/DateLUTImpl.h" #include "Common/DateLUTImpl.h"
#include "Common/Exception.h"
#include <Common/DateLUT.h> #include <Common/DateLUT.h>
#include <Common/typeid_cast.h> #include <Common/typeid_cast.h>
#include "Columns/IColumn.h" #include "Columns/IColumn.h"
@ -23,6 +24,12 @@
namespace DB namespace DB
{ {
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
}
namespace namespace
{ {
@ -73,11 +80,11 @@ public:
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
{ {
FunctionArgumentDescriptors args{ if (arguments.size() != 2)
{mandatory_argument_names[0], &isDateOrDate32OrDateTimeOrDateTime64<IDataType>, nullptr, "Date(32) or DateTime(64)"}, throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Function {} requires 2 parameters: date, new_value. Passed {}.", getName(), arguments.size());
{mandatory_argument_names[1], &isNumber<IDataType>, nullptr, "Number"}
}; if (!isDateOrDate32OrDateTimeOrDateTime64(*arguments[0].type) || !isNumber(*arguments[1].type))
validateFunctionArgumentTypes(*this, arguments, args); throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "First argument for function {} must be Date(32) or DateTime(64), second - numeric", getName());
if (isTimeChange(Traits::EnumName)) if (isTimeChange(Traits::EnumName))
{ {
@ -110,7 +117,6 @@ public:
return execute<DataTypeDateTime64, DataTypeDateTime64>(arguments, input_type, result_type, input_rows_count); return execute<DataTypeDateTime64, DataTypeDateTime64>(arguments, input_type, result_type, input_rows_count);
} }
template <typename DataType, typename ResultDataType> template <typename DataType, typename ResultDataType>
ColumnPtr execute(const ColumnsWithTypeAndName & arguments, const DataTypePtr & input_type, const DataTypePtr & result_type, size_t input_rows_count) const ColumnPtr execute(const ColumnsWithTypeAndName & arguments, const DataTypePtr & input_type, const DataTypePtr & result_type, size_t input_rows_count) const
{ {