You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/12/04 21:46:24 UTC

[GitHub] [arrow] nevi-me commented on a change in pull request #8826: ARROW-10801: [Rust] [Flight] Support sending FlightData for Dictionaries with that of a RecordBatch

nevi-me commented on a change in pull request #8826:
URL: https://github.com/apache/arrow/pull/8826#discussion_r536396692



##########
File path: rust/arrow-flight/src/utils.rs
##########
@@ -26,30 +26,40 @@ use arrow::error::{ArrowError, Result};
 use arrow::ipc::{convert, reader, writer, writer::IpcWriteOptions};
 use arrow::record_batch::RecordBatch;
 
-/// Convert a `RecordBatch` to `FlightData` by converting the header and body to bytes
+/// Convert a `RecordBatch` to a vector of `FlightData` representing the bytes of the dictionaries
+/// and values. This can't be a `From` implementation because neither `RecordBatch` nor `Vec` are

Review comment:
       Happy with this, the `From` impl was hacky, and doesn't work once we need IPC options

##########
File path: rust/arrow-flight/src/utils.rs
##########
@@ -26,30 +26,40 @@ use arrow::error::{ArrowError, Result};
 use arrow::ipc::{convert, reader, writer, writer::IpcWriteOptions};
 use arrow::record_batch::RecordBatch;
 
-/// Convert a `RecordBatch` to `FlightData` by converting the header and body to bytes
+/// Convert a `RecordBatch` to a vector of `FlightData` representing the bytes of the dictionaries
+/// and values. This can't be a `From` implementation because neither `RecordBatch` nor `Vec` are
+/// implemented in this crate.
 ///
 /// Note: This implicitly uses the default `IpcWriteOptions`. To configure options,
 /// use `flight_data_from_arrow_batch()`
-impl From<&RecordBatch> for FlightData {
-    fn from(batch: &RecordBatch) -> Self {
-        let options = IpcWriteOptions::default();
-        flight_data_from_arrow_batch(batch, &options)
-    }
+pub fn convert_to_flight_data(batch: &RecordBatch) -> Vec<FlightData> {
+    let options = IpcWriteOptions::default();

Review comment:
       It's safer to take this as a function argument, because one might want to support either V4 or V5 of the IPC format.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org