Dandandan commented on code in PR #3207:
URL: https://github.com/apache/arrow-rs/pull/3207#discussion_r1044651145


##########
arrow-flight/src/utils.rs:
##########
@@ -44,6 +46,32 @@ pub fn flight_data_from_arrow_batch(
     (flight_dictionaries, flight_batch)
 }
 
+/// Convert a slice of wire protocol `FlightData`s into a vector of 
`RecordBatch`es
+pub fn flight_data_to_batches(
+    flight_data: &[FlightData],
+) -> Result<Vec<RecordBatch>, ArrowError> {
+    let schema = flight_data.get(0).ok_or_else(|| {
+        ArrowError::CastError("Need at least one FlightData for 
schema".to_string())
+    })?;
+    let message = root_as_message(&schema.data_header[..])
+        .map_err(|_| ArrowError::CastError("Cannot get root as 
message".to_string()))?;
+
+    let ipc_schema: arrow_ipc::Schema = 
message.header_as_schema().ok_or_else(|| {
+        ArrowError::CastError("Cannot get header as Schema".to_string())
+    })?;
+    let schema = fb_to_schema(ipc_schema);
+    let schema = Arc::new(schema);
+
+    let mut batches = vec![];
+    let dictionaries_by_id = HashMap::new();

Review Comment:
   This doesn't support dictionaries yet? Maybe we can turn this into an issue?



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