Fix tests

This commit is contained in:
Alexey Milovidov 2024-03-09 18:53:31 +01:00
parent e9ab3ed2dd
commit 3ac4f56cfa
4 changed files with 22 additions and 15 deletions

View File

@ -15,7 +15,7 @@ class IFunctionBase;
using FunctionBasePtr = std::shared_ptr<const IFunctionBase>;
FunctionBasePtr createFunctionBaseCast(
ContextPtr, const ColumnsWithTypeAndName &, const DataTypePtr &, std::optional<CastDiagnostic>, CastType)
ContextPtr, const char *, const ColumnsWithTypeAndName &, const DataTypePtr &, std::optional<CastDiagnostic>, CastType)
{
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Type conversions are not implemented for Library Bridge");
}

View File

@ -15,7 +15,7 @@ class IFunctionBase;
using FunctionBasePtr = std::shared_ptr<const IFunctionBase>;
FunctionBasePtr createFunctionBaseCast(
ContextPtr, const ColumnsWithTypeAndName &, const DataTypePtr &, std::optional<CastDiagnostic>, CastType)
ContextPtr, const char *, const ColumnsWithTypeAndName &, const DataTypePtr &, std::optional<CastDiagnostic>, CastType)
{
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Type conversions are not implemented for Library Bridge");
}

View File

@ -17,11 +17,12 @@ namespace ErrorCodes
}
FunctionBasePtr createFunctionBaseCast(
ContextPtr context
, const ColumnsWithTypeAndName & arguments
, const DataTypePtr & return_type
, std::optional<CastDiagnostic> diagnostic
, CastType cast_type);
ContextPtr context,
const char * name,
const ColumnsWithTypeAndName & arguments,
const DataTypePtr & return_type,
std::optional<CastDiagnostic> diagnostic,
CastType cast_type);
/** CastInternal does not preserve nullability of the data type,
@ -33,7 +34,7 @@ FunctionBasePtr createFunctionBaseCast(
class CastOverloadResolverImpl : public IFunctionOverloadResolver
{
public:
String getName() const override
const char * getNameImpl() const
{
if (cast_type == CastType::accurate)
return "accurateCast";
@ -45,6 +46,11 @@ public:
return "CAST";
}
String getName() const override
{
return getNameImpl();
}
size_t getNumberOfArguments() const override { return 2; }
ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {1}; }
@ -72,7 +78,7 @@ public:
protected:
FunctionBasePtr buildImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & return_type) const override
{
return createFunctionBaseCast(context, arguments, return_type, diagnostic, cast_type);
return createFunctionBaseCast(context, getNameImpl(), arguments, return_type, diagnostic, cast_type);
}
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override

View File

@ -4963,11 +4963,12 @@ public:
FunctionBasePtr createFunctionBaseCast(
ContextPtr context
, const ColumnsWithTypeAndName & arguments
, const DataTypePtr & return_type
, std::optional<CastDiagnostic> diagnostic
, CastType cast_type)
ContextPtr context,
const char * name,
const ColumnsWithTypeAndName & arguments,
const DataTypePtr & return_type,
std::optional<CastDiagnostic> diagnostic,
CastType cast_type)
{
DataTypes data_types(arguments.size());
@ -4975,7 +4976,7 @@ FunctionBasePtr createFunctionBaseCast(
data_types[i] = arguments[i].type;
auto monotonicity = MonotonicityHelper::getMonotonicityInformation(arguments.front().type, return_type.get());
return std::make_unique<FunctionCast>(context, "CAST", std::move(monotonicity), data_types, return_type, diagnostic, cast_type);
return std::make_unique<FunctionCast>(context, name, std::move(monotonicity), data_types, return_type, diagnostic, cast_type);
}
REGISTER_FUNCTION(Conversion)