kosiew opened a new pull request, #16681:
URL: https://github.com/apache/datafusion/pull/16681

   
   ## Which issue does this PR close?
   
   - Closes [#16677](https://github.com/apache/datafusion/issues/16677)
   
   ## Rationale for this change
   
   The default implementation of `ScalarUDFImpl::equals` previously relied on 
comparing the type ID, name, and signature of UDFs. However, this could 
incorrectly treat different instances as equal if their interfaces matched.
   
   To avoid false positives, the default behavior now conservatively assumes 
UDFs are not equal unless they are the exact same instance (pointer 
comparison). This encourages implementers to define equality semantics 
explicitly when UDFs contain internal state.
   
   ## What changes are included in this PR?
   
   - Updated the default `ScalarUDFImpl::equals` method to return `true` only 
for identical pointers.
   - Added `udf_equals.rs` test module with extensive unit tests covering 
equality and inequality between various UDF implementations.
   - Enhanced documentation with guidance on implementing `equals`, including a 
complete Rust example.
   - Noted the breaking change in the library upgrade guide.
   
   ## Are these changes tested?
   
   Yes, new unit tests in `udf_equals.rs` verify:
   
   - Equality for same-type and same-param UDFs
   - Inequality for different types or param values
   - Behavior for default `equals` implementation
   
   ## Are there any user-facing changes?
   
   Yes. This is a **breaking change** to the behavior of 
`ScalarUDFImpl::equals`. Developers who previously relied on the default 
implementation must now override `equals` if their UDFs have internal state or 
require specific equality logic.
   
   The upgrade guide has been updated with migration advice and examples.
   


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