Ambiguous hash values for PhysicalExpr
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### 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,
}
impl Hash for IsNullExpr {
fn hash(&self, state: &mut H) {
self.arg.hash(state);
}
}
```
and
```
/// IS NOT NULL expression
#[derive(Debug, Eq)]
pub struct IsNotNullExpr {
/// The input expression
arg: Arc,
}
impl Hash for IsNotNullExpr {
fn hash(&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(&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_
Contributor guide
Research direction
Start by locating the PhysicalExpr trait and the Hash implementations for IsNullExpr and IsNotNullExpr. Trace how their hashes are consumed, then determine how distinct PhysicalExpr implementations should produce distinct values; done means the ambiguity is resolved without breaking existing hashing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100