thinkharderdev opened a new issue, #18515:
URL: https://github.com/apache/datafusion/issues/18515

   ### Is your feature request related to a problem or challenge?
   
   Several distinct `PhysicalExpr` implementations produce identical hash 
values.
   
   For example, both 
   ```
   #[derive(Debug, Hash)]
   pub struct IsNullExpr {
       /// Input expression
       arg: Arc<dyn PhysicalExpr>,
   }
   
   impl Hash for IsNullExpr {
       fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
           self.arg.hash(state);
       }
   }
   ```
   
   and 
   ```
   /// IS NOT NULL expression
   #[derive(Debug, Eq)]
   pub struct IsNotNullExpr {
       /// The input expression
       arg: Arc<dyn PhysicalExpr>,
   }
   
   impl Hash for IsNotNullExpr {
       fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
           self.arg.hash(state);
       }
   }
   ```
   
   produce the same hash for the same `arg` (eg `expr IS NULL` and `expr IS NOT 
NULL` will produce the same hash)
   
   ### Describe the solution you'd like
   
   Not entirely sure but maybe something like this?
   ```
   impl Hash for dyn PhysicalExpr {
       fn hash<H: Hasher>(&self, state: &mut H) {
           self.type_id().hash(state);
           self.dyn_hash(state);
       }
   }
   ```
   
   ### Describe alternatives you've considered
   
   Not do anything
   
   ### Additional context
   
   _No response_


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