alamb commented on code in PR #2341:
URL: https://github.com/apache/arrow-datafusion/pull/2341#discussion_r859091593
##########
datafusion/proto/src/serde.rs:
##########
@@ -0,0 +1,102 @@
+use std::{collections::HashSet, sync::Arc};
+
+use crate::{from_proto::parse_expr, protobuf};
+use datafusion::{
+ common::{DataFusionError, Result},
+ logical_expr::{AggregateUDF, ScalarUDF},
+ logical_plan::{Expr, FunctionRegistry},
+};
+use prost::{bytes::BytesMut, Message};
+
+/// Encodes an [`Expr`] into a stream of bytes. See
+/// [`deserialize_expr`] to convert a stream of bytes back to an Expr
+///
+/// Open Questions:
+/// Should this be its own crate / API (aka datafusion-serde?) that can be
implemented using proto?
+///
+///
+/// Example:
+///
+/// ```
+/// use datafusion::prelude::*;
+/// use datafusion_proto::serde::Serializeable;
+///
+/// // Create a new `Expr` a < 32
+/// let expr = col("a").lt(lit(5i32));
+///
+/// // Convert it to an opaque form
+/// let bytes = expr.serialize().unwrap();
+///
+/// // Decode bytes from somewhere (over network, etc.
+/// let decoded_expr = Expr::deserialize(&bytes).unwrap();
+/// assert_eq!(expr, decoded_expr);
+/// ```
+pub trait Serializeable: Sized {
Review Comment:
Question for reviewers:
1. Should this be its own crate / API (aka datafusion-serde?) that can be
implemented using proto?
Or perhaps we can make that change in a subsequent PR
--
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]