mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Use FunctionArgumentDescriptors in getReturnTypeImpl()
This commit is contained in:
parent
3a85f79fcb
commit
dee8775c6a
@ -458,6 +458,8 @@ inline bool isUInt32(const T & data_type) { return WhichDataType(data_type).isUI
|
||||
template <typename T>
|
||||
inline bool isUInt64(const T & data_type) { return WhichDataType(data_type).isUInt64(); }
|
||||
template <typename T>
|
||||
inline bool isNativeUnsignedInteger(const T & data_type) { return WhichDataType(data_type).isNativeUInt(); }
|
||||
template <typename T>
|
||||
inline bool isUnsignedInteger(const T & data_type) { return WhichDataType(data_type).isUInt(); }
|
||||
|
||||
template <typename T>
|
||||
|
@ -77,13 +77,13 @@ public:
|
||||
|
||||
size_t getNumberOfArguments() const override { return 1; }
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
|
||||
{
|
||||
WhichDataType which_first(arguments[0]->getTypeId());
|
||||
FunctionArgumentDescriptors args{
|
||||
{"days", &isNativeUnsignedInteger<IDataType>, nullptr, "UInt*"}
|
||||
};
|
||||
|
||||
if (!which_first.isInt() && !which_first.isUInt())
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Illegal type {} of argument of function {}",
|
||||
arguments[0]->getName(), getName());
|
||||
validateFunctionArgumentTypes(*this, arguments, args);
|
||||
|
||||
return std::make_shared<typename Traits::ReturnDataType>();
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ SELECT 739136 AS x, fromDaysSinceYearZero32(x);
|
||||
SELECT 693961 AS x, fromDaysSinceYearZero32(x);
|
||||
SELECT 785063 AS x, fromDaysSinceYearZero32(x);
|
||||
SELECT 785064 AS x, fromDaysSinceYearZero32(x);
|
||||
SELECT -10 AS x, fromDaysSinceYearZero(x), 'lower clip, 1970-01-01 min'; -- {serverError ARGUMENT_OUT_OF_BOUND}
|
||||
SELECT -10 AS x, fromDaysSinceYearZero32(x), 'lower clip, 1970-01-01 min'; -- {serverError ARGUMENT_OUT_OF_BOUND}
|
||||
SELECT -10 AS x, fromDaysSinceYearZero(x), 'lower clip, 1970-01-01 min'; -- {serverError ILLEGAL_TYPE_OF_ARGUMENT}
|
||||
SELECT -10 AS x, fromDaysSinceYearZero32(x), 'lower clip, 1970-01-01 min'; -- {serverError ILLEGAL_TYPE_OF_ARGUMENT}
|
||||
SELECT fromDaysSinceYearZero(NULL);
|
||||
SELECT fromDaysSinceYearZero32(NULL);
|
||||
|
||||
@ -40,8 +40,8 @@ SELECT 739136 AS x, fromDaysSinceYearZero32(x);
|
||||
SELECT 693961 AS x, fromDaysSinceYearZero32(x);
|
||||
SELECT 785063 AS x, fromDaysSinceYearZero32(x);
|
||||
SELECT 785064 AS x, fromDaysSinceYearZero32(x);
|
||||
SELECT -10 AS x, fromDaysSinceYearZero(x), 'lower clip, 1970-01-01 min'; -- {serverError ARGUMENT_OUT_OF_BOUND}
|
||||
SELECT -10 AS x, fromDaysSinceYearZero32(x), 'lower clip, 1970-01-01 min'; -- {serverError ARGUMENT_OUT_OF_BOUND}
|
||||
SELECT -10 AS x, fromDaysSinceYearZero(x), 'lower clip, 1970-01-01 min'; -- {serverError ILLEGAL_TYPE_OF_ARGUMENT}
|
||||
SELECT -10 AS x, fromDaysSinceYearZero32(x), 'lower clip, 1970-01-01 min'; -- {serverError ILLEGAL_TYPE_OF_ARGUMENT}
|
||||
SELECT fromDaysSinceYearZero(NULL);
|
||||
SELECT fromDaysSinceYearZero32(NULL);
|
||||
|
||||
@ -63,8 +63,8 @@ SELECT 785064 AS x, fromDaysSinceYearZero32(x);
|
||||
SELECT fromDaysSinceYearZero(NULL);
|
||||
SELECT fromDaysSinceYearZero32(NULL);
|
||||
SELECT 0.5 AS x, fromDaysSinceYearZero(x); -- {serverError ILLEGAL_TYPE_OF_ARGUMENT}
|
||||
SELECT -10 AS x, fromDaysSinceYearZero(x), 'lower clip, 1970-01-01 min'; -- {serverError ARGUMENT_OUT_OF_BOUND}
|
||||
SELECT -10 AS x, fromDaysSinceYearZero32(x), 'lower clip, 1970-01-01 min'; -- {serverError ARGUMENT_OUT_OF_BOUND}
|
||||
SELECT -10 AS x, fromDaysSinceYearZero(x), 'lower clip, 1970-01-01 min'; -- {serverError ILLEGAL_TYPE_OF_ARGUMENT}
|
||||
SELECT -10 AS x, fromDaysSinceYearZero32(x), 'lower clip, 1970-01-01 min'; -- {serverError ILLEGAL_TYPE_OF_ARGUMENT}
|
||||
SELECT 0 AS x, fromDaysSinceYearZero(x), 'lower clip, 1970-01-01 min'; -- {serverError VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE}
|
||||
SELECT 719527 AS x, fromDaysSinceYearZero(x), 'lower clip, 1970-01-01 min'; -- {serverError VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE}
|
||||
SELECT 785064 AS x, fromDaysSinceYearZero(x), 'upper clip, 2149-06-06 max'; -- {serverError VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE}
|
||||
|
Loading…
Reference in New Issue
Block a user