pitrou commented on a change in pull request #10550:
URL: https://github.com/apache/arrow/pull/10550#discussion_r655196937



##########
File path: cpp/src/arrow/compute/kernels/scalar_cast_internal.cc
##########
@@ -255,7 +255,12 @@ static bool CanCastFromDictionary(Type::type type_id) {
 
 void AddCommonCasts(Type::type out_type_id, OutputType out_ty, CastFunction* 
func) {
   // From null to this type
-  DCHECK_OK(func->AddKernel(Type::NA, {null()}, out_ty, CastFromNull));
+  ScalarKernel kernel;
+  kernel.exec = CastFromNull;
+  kernel.signature = KernelSignature::Make({null()}, out_ty);
+  kernel.null_handling = NullHandling::COMPUTED_NO_PREALLOCATE;
+  kernel.mem_allocation = MemAllocation::NO_PREALLOCATE;

Review comment:
       Not sure, because `MakeArrayOfNull` allocates a single 
(sufficiently-sized) buffer of 0s for all array buffers. Preallocating in the 
kernel execution machinery without any specific knowledge about the kernel 
would allocate distinct buffers and consume more memory (though probably not 
that much).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to