| 287 | } |
| 288 | |
| 289 | void AddCommonCasts(Type::type out_type_id, OutputType out_ty, CastFunction* func) { |
| 290 | // From null to this type |
| 291 | ScalarKernel kernel; |
| 292 | kernel.exec = CastFromNull; |
| 293 | kernel.signature = KernelSignature::Make({null()}, out_ty); |
| 294 | kernel.null_handling = NullHandling::COMPUTED_NO_PREALLOCATE; |
| 295 | kernel.mem_allocation = MemAllocation::NO_PREALLOCATE; |
| 296 | DCHECK_OK(func->AddKernel(Type::NA, std::move(kernel))); |
| 297 | |
| 298 | // From dictionary to this type |
| 299 | if (CanCastFromDictionary(out_type_id)) { |
| 300 | // Dictionary unpacking not implemented for boolean or nested types. |
| 301 | DCHECK_OK(func->AddKernel(Type::DICTIONARY, {InputType(Type::DICTIONARY)}, out_ty, |
| 302 | UnpackDictionary, NullHandling::COMPUTED_NO_PREALLOCATE, |
| 303 | MemAllocation::NO_PREALLOCATE)); |
| 304 | } |
| 305 | |
| 306 | // From extension type to this type |
| 307 | DCHECK_OK(func->AddKernel(Type::EXTENSION, {InputType(Type::EXTENSION)}, out_ty, |
| 308 | CastFromExtension, NullHandling::COMPUTED_NO_PREALLOCATE, |
| 309 | MemAllocation::NO_PREALLOCATE)); |
| 310 | } |
| 311 | |
| 312 | } // namespace internal |
| 313 | } // namespace compute |
no test coverage detected