Skip to content

Commit

Permalink
Fix merging stores with max_key=0 (#58)
Browse files Browse the repository at this point in the history
Since 0 is falsy, the condition would set second_key to the value of key
when 0 was passed.
  • Loading branch information
Kyle-Verhoog authored Jul 21, 2022
1 parent 9541028 commit c0b33bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ddsketch/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ def _get_new_length(self, new_min_key, new_max_key):
def _extend_range(self, key, second_key=None):
# type: (int, Optional[int]) -> None
"""Grow the bins as necessary and call _adjust"""
second_key = second_key or key
if second_key is None:
second_key = key
new_min_key = min(key, second_key, self.min_key)
new_max_key = max(key, second_key, self.max_key)

Expand Down
4 changes: 4 additions & 0 deletions releasenotes/notes/extend-range-06474632c8235187.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
Fix merging stores with max_key=0.

0 comments on commit c0b33bc

Please sign in to comment.