#include #include namespace DB { template static ColumnPtr castColumn(const ColumnWithTypeAndName & arg, const DataTypePtr & type) { if (arg.type->equals(*type)) return arg.column; ColumnsWithTypeAndName arguments { arg, { DataTypeString().createColumnConst(arg.column->size(), type->getName()), std::make_shared(), "" } }; FunctionOverloadResolverPtr func_builder_cast = CastInternalOverloadResolver::createImpl(); auto func_cast = func_builder_cast->build(arguments); if constexpr (cast_type == CastType::accurateOrNull) { return func_cast->execute(arguments, makeNullable(type), arg.column->size()); } else { return func_cast->execute(arguments, type, arg.column->size()); } } ColumnPtr castColumn(const ColumnWithTypeAndName & arg, const DataTypePtr & type) { return castColumn(arg, type); } ColumnPtr castColumnAccurate(const ColumnWithTypeAndName & arg, const DataTypePtr & type) { return castColumn(arg, type); } ColumnPtr castColumnAccurateOrNull(const ColumnWithTypeAndName & arg, const DataTypePtr & type) { return castColumn(arg, type); } }