Tristan1900 opened a new issue, #9388:
URL: https://github.com/apache/arrow-rs/issues/9388

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   `split_batch_for_grpc_response` uses 
[this](https://github.com/apache/arrow-rs/blob/54d81919206d667d36ba4b5f76ff8e7ed9d341dd/arrow-flight/src/encode.rs#L621)
 to estimate batch size for splitting. This calls buffer.capacity(), which 
reports the full backing allocation size, not the actual data size.
   After IPC deserialization, the IPC reader creates all buffers by slicing one 
shared `Buffer` via 
[this](https://github.com/apache/arrow-rs/blob/54d81919206d667d36ba4b5f76ff8e7ed9d341dd/arrow-buffer/src/buffer/immutable.rs#L298-L312),
 which clones the Arc<Bytes>. So every buffer's capacity() reports the entire 
message body size rather than its own slice.
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   `FlightDataEncoderBuilder` encode -> `FlightRecordBatchStream` decode -> 
`FlightDataEncoderBuilder` re-encode produces more FlightData than just 
`FlightDataEncoderBuilder` encode 
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->
   #5352


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