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


##########
cpp/src/arrow/compute/kernels/vector_statistics.cc:
##########
@@ -127,7 +128,17 @@ 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];
+    // A zero-offset input can share its validity bitmap, because the output 
is read from
+    // bit 0 as well. A sliced input cannot: sharing would read the bitmap 
from bit 0
+    // instead of from `data.offset`, so copy the slice's bits out.

Review Comment:
   Done in 
https://github.com/apache/arrow/commit/c0882dbed77501a7d91fb41d47ae0fa29ffad459.
 Confirmed against `ExecChunked`, which seeds the output from 
`chunk->data()->Copy()`, so a sliced chunk carried its offset into buffers 
built for the slice alone. `TestWinsorize.SlicedChunkedInput` covers it and 
fails without the change.



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