| 1275 | |
| 1276 | template <template <typename, RoundMode, typename...> class Op, typename OptionsType> |
| 1277 | std::shared_ptr<ScalarFunction> MakeBinaryRoundFunction(const std::string& name, |
| 1278 | FunctionDoc doc) { |
| 1279 | static const OptionsType kDefaultOptions = OptionsType::Defaults(); |
| 1280 | auto func = std::make_shared<RoundFunction>(name, Arity::Binary(), std::move(doc), |
| 1281 | &kDefaultOptions); |
| 1282 | RoundKernelGenerator<Op, RoundBinaryKernel, OptionsType> kernel_generator; |
| 1283 | for (const auto& tys : {NumericTypes(), {decimal128(1, 0), decimal256(1, 0)}}) { |
| 1284 | for (const auto& ty : tys) { |
| 1285 | ArrayKernelExec exec = nullptr; |
| 1286 | KernelInit init; |
| 1287 | DCHECK_OK(VisitTypeInline(*ty, &kernel_generator, &exec, &init)); |
| 1288 | DCHECK_OK(func->AddKernel( |
| 1289 | {InputType(ty->id()), Type::INT32}, |
| 1290 | is_decimal(ty->id()) ? OutputType(FirstType) : OutputType(ty), exec, init)); |
| 1291 | } |
| 1292 | } |
| 1293 | AddNullExec(func.get()); |
| 1294 | return func; |
| 1295 | } |
| 1296 | |
| 1297 | template <typename Op, typename FunctionImpl = RoundFloatingPointFunction> |
| 1298 | std::shared_ptr<ScalarFunction> MakeUnaryRoundFunctionFloatingPoint(std::string name, |
nothing calls this directly
no test coverage detected