| 1299 | } |
| 1300 | |
| 1301 | void 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 | |
| 1326 | void AddBinaryIfElseKernels(const std::shared_ptr<IfElseFunction>& scalar_function, |
| 1327 | const std::vector<std::shared_ptr<DataType>>& types) { |
no test coverage detected