Commit d722bdc
fix: drop Python callable from UDF Hash impls
`Python::attach(|py| self.func.bind(py).hash().unwrap_or(0))`
silently collapsed every unhashable closure (e.g. a lambda with an
unhashable captured value) to the same hash bucket — the worst case
for hashmap lookups, and arrived at via `unwrap_or` rather than a
deliberate design choice.
Hash on the identifying header (name + signature + return field /
state fields) only. The Rust `Hash` contract requires
`a == b ⇒ hash(a) == hash(b)`, not the converse, so a coarser hash
is still sound — `PartialEq` (which still calls Python `eq` on the
callable) disambiguates two UDFs that share a header but differ in
their callable. Applied symmetrically to scalar, aggregate, and
window UDFs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0b8672e commit d722bdc
3 files changed
Lines changed: 15 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
252 | 255 | | |
253 | 256 | | |
254 | 257 | | |
255 | 258 | | |
256 | 259 | | |
257 | 260 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | 261 | | |
263 | 262 | | |
264 | 263 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
109 | 118 | | |
110 | 119 | | |
111 | 120 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
343 | 346 | | |
344 | 347 | | |
345 | 348 | | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | 349 | | |
351 | 350 | | |
352 | 351 | | |
| |||
0 commit comments