andygrove commented on code in PR #4892:
URL: https://github.com/apache/arrow-datafusion/pull/4892#discussion_r1072908852


##########
datafusion/substrait/src/serializer.rs:
##########
@@ -44,7 +49,9 @@ pub async fn deserialize(path: &str) -> Result<Box<Plan>> {
     let mut file = OpenOptions::new().read(true).open(path)?;
 
     file.read_to_end(&mut protobuf_in)?;
-    let proto = Message::decode(&*protobuf_in).unwrap();
+    deserialize_bytes(protobuf_in).await
+}
 
-    Ok(Box::new(proto))
+pub async fn deserialize_bytes(proto_bytes: Vec<u8>) -> Result<Box<Plan>> {
+    Ok(Box::new(Message::decode(&*proto_bytes).unwrap()))

Review Comment:
   ```suggestion
       Ok(Box::new(Message::decode(&*proto_bytes).map_err(|e| {
           DataFusionError::Internal(format!("Failed to decode substrait plan: 
{}", e))
       })?))
   ```



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to