alamb commented on code in PR #17081:
URL: https://github.com/apache/datafusion/pull/17081#discussion_r2267105105


##########
datafusion/expr-common/src/dyn_eq.rs:
##########
@@ -0,0 +1,67 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::any::Any;
+use std::hash::{Hash, Hasher};
+
+/// A dyn-compatible version of [`Eq`] trait.
+/// The implementation constraints for this trait are the same as for [`Eq`]:
+/// the implementation must be reflexive, symmetric, and transitive.
+/// Additionally, if two values can be compared with [`DynEq`] and 
[`PartialEq`] then
+/// they must be [`DynEq`]-equal if and only if they are [`PartialEq`]-equal.
+/// It is therefore strongly discouraged to implement this trait for types
+/// that implement `PartialEq<Other>` or `Eq<Other>` for any type `Other` 
other than `Self`.
+///
+/// Note: This trait should not be implemented directly. Implement `Eq` and 
`Any` and use
+/// the blanket implementation.
+pub trait DynEq {
+    fn dyn_eq(&self, other: &dyn Any) -> bool;
+
+    fn 
i_did_not_implement_the_trait_directly_but_using_the_blanked_impl_instead()

Review Comment:
   is this something we should plan to do with a follow on PR?



##########
docs/source/library-user-guide/upgrading.md:
##########
@@ -24,6 +24,12 @@
 **Note:** DataFusion `50.0.0` has not been released yet. The information 
provided in this section pertains to features and changes that have already 
been merged to the main branch and are awaiting release in this version.
 You can see the current [status of the `50.0.0 `release 
here](https://github.com/apache/datafusion/issues/16799)
 
+### `WindowUDFImpl` trait now requires `PartialEq`, `Eq`, and `Hash` traits
+
+To address error-proneness of `WindowUDFImpl::equals` method and to make it 
easy to implement function
+equality correctly, the `WindowUDFImpl::equals` and 
`WindowUDFImpl::hash_value` methods have been replaced
+with the requirement to implement the `PartialEq`, `Eq`, and `Hash` traits on 
any type implementing `WindowUDFImpl`.

Review Comment:
   ```suggestion
   with the requirement to implement the `PartialEq`, `Eq`, and `Hash` traits 
on any type implementing `WindowUDFImpl`. Please see [issue #16677] for more 
details
   
   [issue #16677]: https://github.com/apache/datafusion/issues/16677
   ```



-- 
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...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to