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


##########
datafusion/proto/src/physical_plan/from_proto.rs:
##########
@@ -207,10 +212,19 @@ where
 /// * `codec` - An extension codec used to decode custom UDFs.
 pub fn parse_physical_expr(
     proto: &protobuf::PhysicalExprNode,
-    ctx: &TaskContext,
+    decode_ctx: &DecodeContext,
     input_schema: &Schema,
     codec: &dyn PhysicalExtensionCodec,
 ) -> Result<Arc<dyn PhysicalExpr>> {
+    // Check cache first if an ID is present
+    if let Some(id) = proto.id {
+        if let Some(cached) = decode_ctx.get_cached_expr(id) {
+            return Ok(cached);
+        }
+    }
+

Review Comment:
   🤔 your idea for having callbacks in 
https://github.com/apache/datafusion/pull/17370 could be a good alternative, 
although I wonder how those can be set from the outside in an arbitrary 
`Arc<dyn ExecutionPlan>`. 
   
   If we had a way of getting all the dynamic filter expressions in a plan 
(`fn(plan: &Arc<dyn ExecutionPlan>) -> Vec<&DynamicPhysicalExpr>`) this would 
indeed be a very nice approach.



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