MCPcopy Create free account
hub / github.com/apache/arrow / MakeUnaryRoundFunction

Function MakeUnaryRoundFunction

cpp/src/arrow/compute/kernels/scalar_round.cc:1250–1268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1248// non-null output.
1249template <template <typename, RoundMode, typename...> class Op, typename OptionsType>
1250std::shared_ptr<ScalarFunction> MakeUnaryRoundFunction(std::string name,
1251 FunctionDoc doc) {
1252 static const OptionsType kDefaultOptions = OptionsType::Defaults();
1253 auto func = std::make_shared<RoundFunction>(name, Arity::Unary(), std::move(doc),
1254 &kDefaultOptions);
1255 RoundKernelGenerator<Op, RoundKernel, OptionsType> kernel_generator;
1256 for (const auto& tys : {NumericTypes(), {decimal128(1, 0), decimal256(1, 0)}}) {
1257 for (const auto& ty : tys) {
1258 ArrayKernelExec exec = nullptr;
1259 KernelInit init;
1260 DCHECK_OK(VisitTypeInline(*ty, &kernel_generator, &exec, &init));
1261 DCHECK_OK(func->AddKernel(
1262 {InputType(ty->id())},
1263 is_decimal(ty->id()) ? OutputType(FirstType) : OutputType(ty), exec, init));
1264 }
1265 }
1266 AddNullExec(func.get());
1267 return func;
1268}
1269
1270template <template <typename, RoundMode, typename...> class Op, typename OptionsType>
1271std::shared_ptr<ScalarFunction> MakeBinaryRoundFunction(const std::string& name,

Callers

nothing calls this directly

Calls 12

UnaryFunction · 0.85
decimal256Function · 0.85
VisitTypeInlineFunction · 0.85
InputTypeFunction · 0.85
OutputTypeFunction · 0.85
AddNullExecFunction · 0.85
DefaultsFunction · 0.50
decimal128Function · 0.50
is_decimalFunction · 0.50
AddKernelMethod · 0.45
idMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected