milenkovicm commented on code in PR #24826:
URL: https://github.com/apache/datafusion/pull/24826#discussion_r3902724266


##########
datafusion/proto/src/physical_plan/mod.rs:
##########
@@ -2058,6 +2078,146 @@ impl PhysicalExtensionCodec for 
ComposedPhysicalExtensionCodec {
     }
 }
 
+/// A PhysicalExtensionCodec that tries one of multiple inner codecs until one 
works.
+/// The name of the codec that successfully encoded an [`ExecutionPlan`] is 
stored in the
+/// encoded payload, and the codec with that exact name will be used for 
decoding.
+#[derive(Default, Debug)]
+pub struct ComposedNamedPhysicalExtensionCodec {
+    codecs: HashMap<Cow<'static, str>, Arc<dyn PhysicalExtensionCodec>>,
+}

Review Comment:
   coming from perspective of building binary protocols having string as a key 
does not look like best practice.  you're right string keys might not be much 
but it does not mean it should be used, there is no real benefit of it compared 
to integers, apart from delaying decision on codec composition.  
   
   if you have sortable keys, you can add priority in which encoders should be 
executed, its a user decision, this  makes encoding deterministic. 



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