Uh oh!
There was an error while loading. Please reload this page.
Fix hash/equality issues for ScalarFunctionExpr - #17078
Conversation
The equality implementation for ScalarFunctionExpr could incorrectly return true when one compared object has more config options. This is because the `iterator.zip(other)` terminates whenever one of the zipped iterators terminates.
The `ScalarFunctionExpr` equality compares config options ignoring the order, and so hash should ignore order too.
Use standard pattern for implementing `DynEq` and `DynHash` -- they should be derived from `Eq` and `Hash` implementations.
Uh oh!
There was an error while loading. Please reload this page.
comphead
left a comment
There was a problem hiding this comment.
Thanks @findepi just to refresh my memory https://doc.rust-lang.org/std/cmp/trait.Eq.html soa == b will effectively call PartialEq and we dont need separate impl for Eq?
findepi
commented
Aug 8, 2025
yes
|
Uh oh!
There was an error while loading. Please reload this page.
* Fix equality impl for ScalarFunctionExpr The equality implementation for ScalarFunctionExpr could incorrectly return true when one compared object has more config options. This is because the `iterator.zip(other)` terminates whenever one of the zipped iterators terminates. * Fix hash/equality inconsistency for ScalarFunctionExpr The `ScalarFunctionExpr` equality compares config options ignoring the order, and so hash should ignore order too. * Derive dyn eq,hash for ScalarFunctionExpr from plain eq, hash Use standard pattern for implementing `DynEq` and `DynHash` -- they should be derived from `Eq` and `Hash` implementations. * Fix doc example for implementing PhysicalExpr * Short-circuit expensive operations in eq impl for ScalarFunctionExpr
DynEqimplementation forScalarFunctionExpr; it could returntruefor non equal valuesDynHashimplementation forScalarFunctionExprto be consistent with equals