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

Function AddPrimitiveIfElseKernels

cpp/src/arrow/compute/kernels/scalar_if_else.cc:1301–1324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1299}
1300
1301void AddPrimitiveIfElseKernels(const std::shared_ptr<ScalarFunction>& scalar_function,
1302 const std::vector<std::shared_ptr<DataType>>& types) {
1303 for (auto&& type : types) {
1304 auto exec =
1305 internal::GenerateTypeAgnosticPrimitive<ResolveIfElseExec, ArrayKernelExec,
1306 /*AllocateMem=*/std::false_type>(*type);
1307 // cond array needs to be boolean always
1308 std::shared_ptr<KernelSignature> sig;
1309 if (type->id() == Type::TIMESTAMP) {
1310 auto unit = checked_cast<const TimestampType&>(*type).unit();
1311 sig = KernelSignature::Make(
1312 {boolean(), match::TimestampTypeUnit(unit), match::TimestampTypeUnit(unit)},
1313 LastType);
1314 } else {
1315 sig = KernelSignature::Make({boolean(), type, type}, type);
1316 }
1317 ScalarKernel kernel(std::move(sig), exec);
1318 kernel.null_handling = NullHandling::COMPUTED_PREALLOCATE;
1319 kernel.mem_allocation = MemAllocation::PREALLOCATE;
1320 kernel.can_write_into_slices = true;
1321
1322 DCHECK_OK(scalar_function->AddKernel(std::move(kernel)));
1323 }
1324}
1325
1326void AddBinaryIfElseKernels(const std::shared_ptr<IfElseFunction>& scalar_function,
1327 const std::vector<std::shared_ptr<DataType>>& types) {

Callers 1

RegisterScalarIfElseFunction · 0.85

Calls 5

TimestampTypeUnitFunction · 0.85
MakeFunction · 0.50
idMethod · 0.45
unitMethod · 0.45
AddKernelMethod · 0.45

Tested by

no test coverage detected