andygrove commented on code in PR #4892: URL: https://github.com/apache/arrow-datafusion/pull/4892#discussion_r1069612984
########## datafusion/substrait/src/serializer.rs: ########## @@ -27,15 +27,19 @@ use std::fs::OpenOptions; use std::io::{Read, Write}; pub async fn serialize(sql: &str, ctx: &SessionContext, path: &str) -> Result<()> { + let protobuf_out = serialize_bytes(sql, ctx); + let mut file = OpenOptions::new().create(true).write(true).open(path)?; + file.write_all(&protobuf_out)?; + Ok(()) +} + +pub async fn serialize_bytes(sql: &str, ctx: &SessionContext) -> Vec::<u8> { let df = ctx.sql(sql).await?; let plan = df.into_optimized_plan()?; let proto = producer::to_substrait_plan(&plan)?; let mut protobuf_out = Vec::<u8>::new(); - proto.encode(&mut protobuf_out).unwrap(); - let mut file = OpenOptions::new().create(true).write(true).open(path)?; - file.write_all(&protobuf_out)?; - Ok(()) + let result = proto.encode(&mut protobuf_out).unwrap(); Review Comment: It looks like this should not compile because there is no value being returned from the function -- 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