andishgar commented on issue #46485: URL: https://github.com/apache/arrow/issues/46485#issuecomment-2907631297
> Given this logic, it seems the current implementation should be modified to copy the arrow::ArrayStatistics instead of creating a new one during the copy operation. 1-Sorry for the confusion in my above message. What I meant to say is that the current implementation should be updated to copy the `arrow::ArrayStatistics `rather than share it during the copy operation. Note: `arrow::ArrayData::statistics` is a `std::shared_ptr `, so the following line shares the object instead of copying it. https://github.com/apache/arrow/blob/8afaf95b38459f97ab12b22ebb7e1913b31025bf/cpp/src/arrow/array/data.cc#L167-L169 2- Both `arrow::ArrayData::ViewOrCopy` and `arrow::ArrayData::CopyTo `use [CopyToImpl](https://github.com/apache/arrow/blob/153da3053b62f8f9bcafb87546e12a979e605734/cpp/src/arrow/array/data.cc#L146-L171). Therefore, it should be specified whether the array is being copied in the line below. If the array is not copied, then `arrow::ArrayData::statistics `should be shared (which is the current behavior). Otherwise, it should be copied. https://github.com/apache/arrow/blob/8afaf95b38459f97ab12b22ebb7e1913b31025bf/cpp/src/arrow/array/data.cc#L167-L169 My suggestion is to use the following code instead of the one above ```c++ if (output->buffers[0]->address() == data.buffers[0]->address()) { // The output is a view output->statistics = data.statistics; }else { // The output is a copy output->statistics = std::make_shared<ArrayStatistics>(*data.statistics); } ``` -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org