wgtmac commented on code in PR #39054:
URL: https://github.com/apache/arrow/pull/39054#discussion_r1413512827


##########
cpp/src/parquet/arrow/reader_internal.cc:
##########
@@ -556,10 +556,16 @@ struct DecimalConverter<DecimalArrayType, FLBAType> {
     const int32_t byte_width =
         checked_cast<const 
::arrow::FixedSizeBinaryType&>(*fixed_size_binary_array.type())
             .byte_width();
-    // allocate memory for the decimal array
-    ARROW_ASSIGN_OR_RAISE(auto data, ::arrow::AllocateBuffer(length * 
type_length, pool));
 
     // raw bytes that we can write to
+    std::shared_ptr<::arrow::Buffer> data;
+    // if the byte width of the FixedSizeBinaryArray is greater than or equal 
to the given
+    // array then we can reuse its data buffer to write the decimal array
+    if (byte_width >= type_length) {
+      data = fixed_size_binary_array.data()->buffers[1];

Review Comment:
   This may change the buffer which is shared by other arrays. So I don't think 
this is a safe 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