gene-bordegaray commented on code in PR #20416:
URL: https://github.com/apache/datafusion/pull/20416#discussion_r2828422104
##########
datafusion/physical-expr/src/expressions/dynamic_filters.rs:
##########
@@ -180,18 +243,99 @@ impl DynamicFilterPhysicalExpr {
}
}
+ /// Reconstructs a [`DynamicFilterPhysicalExpr`] from a snapshot.
+ ///
+ /// This is a low-level API intended for use by the proto deserialization
layer.
+ #[doc(hidden)]
+ pub fn new_from_snapshot(snapshot: DynamicFilterSnapshot) -> Self {
+ let DynamicFilterSnapshot {
+ children,
+ remapped_children,
+ generation,
+ inner_expr,
+ is_complete,
+ } = snapshot;
+
+ let state = if is_complete {
+ FilterState::Complete { generation }
+ } else {
+ FilterState::InProgress { generation }
+ };
+ let (state_watch, _) = watch::channel(state);
+
+ Self {
+ children,
+ remapped_children,
+ inner: Arc::new(RwLock::new(Inner {
+ generation,
+ expr: inner_expr,
+ is_complete,
+ })),
+ state_watch,
+ data_type: Arc::new(RwLock::new(None)),
+ nullable: Arc::new(RwLock::new(None)),
+ }
+ }
+
+ /// Atomically captures all state needed for serialization into a
[`DynamicFilterSnapshot`].
Review Comment:
just an idea, instead of this could we do something like implement the From
triat to convert between Expr and Snapshot
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]