1fanwang commented on code in PR #51251:
URL: https://github.com/apache/arrow/pull/51251#discussion_r3965759984


##########
cpp/src/arrow/compute/kernels/vector_statistics.cc:
##########
@@ -127,7 +128,16 @@ struct Winsorize {
     DCHECK_EQ(out->buffers.size(), data.buffers.size());
     out->null_count = data.null_count.load();
     out->length = data.length;
-    out->buffers[0] = data.buffers[0];
+    // The output is zero-offset, so a sliced input's validity bitmap cannot 
be shared as is:
+    // it would be read from bit 0 instead of from `data.offset`. Copy the 
slice's bits out.
+    if (data.buffers[0]) {
+      ARROW_ASSIGN_OR_RAISE(
+          out->buffers[0], arrow::internal::CopyBitmap(ctx->memory_pool(),
+                                                       
data.buffers[0]->data(), data.offset,
+                                                       data.length));
+    } else {
+      out->buffers[0] = nullptr;
+    }

Review Comment:
   Done in 
https://github.com/apache/arrow/commit/f75624f7495cfa82208276225d0bb133e29b20b3.



-- 
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]

Reply via email to