mslapek commented on code in PR #5421:
URL: https://github.com/apache/arrow-datafusion/pull/5421#discussion_r1122188389


##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1685,8 +1725,33 @@ pub struct Extension {
     pub node: Arc<dyn UserDefinedLogicalNode>,
 }
 
+struct ExtensionExplainDisplay<'a> {
+    extension: &'a Extension,
+}
+
+impl Display for ExtensionExplainDisplay<'_> {
+    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+        self.extension.node.fmt_for_explain(f)
+    }
+}
+
+impl PartialEq for Extension {
+    fn eq(&self, other: &Self) -> bool {
+        format!("{}", ExtensionExplainDisplay { extension: self })
+            == format!("{}", ExtensionExplainDisplay { extension: other })
+    }
+}
+
+impl Eq for Extension {}
+
+impl Hash for Extension {

Review Comment:
   Couldn't add `Hash + PartialEq`, because `UserDefinedLogicalNode` must be 
*object-safe*.
   
   Instead added `dyn_eq` and `dyn_hash` methods serving the same purpose.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to