gabotechs commented on code in PR #20416:
URL: https://github.com/apache/datafusion/pull/20416#discussion_r2851241245


##########
datafusion/proto/src/physical_plan/mod.rs:
##########
@@ -3918,24 +3936,51 @@ impl PhysicalProtoConverterExtension for 
DeduplicatingDeserializer {
     where
         Self: Sized,
     {
-        if let Some(expr_id) = proto.expr_id {
-            // Check cache first
-            if let Some(cached) = self.cache.borrow().get(&expr_id) {
-                return Ok(Arc::clone(cached));
+        // The entire expr is cached, so re-use it.
+        if let Some(expr_id) = proto.expr_id
+            && let Some(cached) = self.cache.borrow().get(&expr_id)
+        {
+            return Ok(Arc::clone(cached));
+        }
+
+        // Cache miss, we must deserialize the expr.
+        let mut expr =
+            parse_physical_expr_with_converter(proto, ctx, input_schema, 
codec, self)?;
+
+        // Check if we need to share inner state with a cached dynamic filter
+        if let Some(dynamic_filter_id) = proto.dynamic_filter_inner_id {

Review Comment:
   The amount of special-casing for handling dynamic filters in the protobuf 
code seems too big in this PR.
   
   The fact that dynamic filters are in a situation where they claim to be 
normal `PhysicalExpr` but they anyway need special treatment and `if dyn_filter 
{ do this special other thing }`  in several parts of the codebase makes me 
think that there might be better ways of approaching things in general. 



-- 
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]

Reply via email to