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


##########
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:
   It is not shared by other arrays because it is only used here
   
https://github.com/apache/arrow/blob/f7947cc21bf78d67cf5ac1bf1894b5e04de1a632/cpp/src/parquet/arrow/reader_internal.cc#L743
   Which is used only here
   
https://github.com/apache/arrow/blob/f7947cc21bf78d67cf5ac1bf1894b5e04de1a632/cpp/src/parquet/arrow/reader.cc#L488-L489
   So this is function only for reading from file and we see that arrays in it 
are not shared



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