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

Function AddCommonCasts

cpp/src/arrow/compute/kernels/scalar_cast_internal.cc:289–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289void 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

Callers 15

GetDictionaryCastsFunction · 0.85
AddCommonNumberCastsFunction · 0.85
GetCastToDecimal32Function · 0.85
GetCastToDecimal64Function · 0.85
GetCastToDecimal128Function · 0.85
GetCastToDecimal256Function · 0.85
GetCastToHalfFloatFunction · 0.85
GetDate32CastFunction · 0.85
GetDate64CastFunction · 0.85
GetDurationCastFunction · 0.85
GetIntervalCastFunction · 0.85
GetTime32CastFunction · 0.85

Calls 4

CanCastFromDictionaryFunction · 0.85
InputTypeFunction · 0.85
MakeFunction · 0.50
AddKernelMethod · 0.45

Tested by

no test coverage detected