lidavidm commented on a change in pull request #11759:
URL: https://github.com/apache/arrow/pull/11759#discussion_r757790779
##########
File path: cpp/src/arrow/compute/kernels/vector_replace.cc
##########
@@ -229,6 +228,12 @@ struct ReplaceWithMask<Type,
std::fill(begin, end, UnboxScalar<Type>::Unbox(in));
}
+ static bool HasBitmap(const ArrayData& replacements) {
+ return replacements.MayHaveNulls();
+ }
+
+ static bool HasBitmap(const Scalar& replacements) { return true; }
+
Review comment:
None of the HasBitmap methods are used anymore.
##########
File path: cpp/src/arrow/compute/kernels/vector_replace.cc
##########
@@ -189,8 +187,9 @@ Status ReplaceWithArrayMask(KernelContext* ctx, const
ArrayData& array,
const ArrayData& array_repl = *replacements.array();
ReplaceWithArrayMaskImpl<Functor>(
array, mask, array_repl, replacements_bitmap,
- CopyArrayBitmap{replacements_bitmap ? array_repl.buffers[0]->data() :
nullptr,
- array_repl.offset},
+ CopyArrayBitmap{
+ (!!array_repl.buffers[0]) ? array_repl.buffers[0]->data() :
nullptr,
Review comment:
nit: 1) why the double negation? but 2) `replacements_bitmap` (the
original condition) is already equivalent or better (MayHaveNulls() will also
be false if the null count is 0, which doesn't necessarily imply that the
validity bitmap is null).
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]