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 2022/12/09 17:03:53 UTC

[GitHub] [arrow-rs] Dandandan commented on a diff in pull request #3207: FlightSQL Client & integration test

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: github-unsubscribe@arrow.apache.org

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