Skip to content

Commit

Permalink
fix: Check CSE name aliases for collisions. (pola-rs#16149)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored May 10, 2024
1 parent e94daa6 commit b38aa4b
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 233 deletions.
9 changes: 8 additions & 1 deletion crates/polars-plan/src/logical_plan/lit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,15 @@ impl Hash for LiteralValue {
std::mem::discriminant(self).hash(state);
match self {
LiteralValue::Series(s) => {
// Free stats
s.dtype().hash(state);
s.len().hash(state);
let len = s.len();
len.hash(state);
s.null_count().hash(state);
// Hash 5 first values. Still a poor hash, but it removes the pathological clashes.
for i in 0..std::cmp::min(5, len) {
s.get(i).unwrap().hash(state);
}
},
LiteralValue::Range {
low,
Expand Down
Loading

0 comments on commit b38aa4b

Please sign in to comment.