Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lift Default impl for Config to one for DDSketch. #11

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/ddsketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ pub struct DDSketch {
zero_count: u64,
}

impl Default for DDSketch {
fn default() -> Self {
Self::new(Default::default())
}
}

// XXX: functions should return Option<> in the case of empty
impl DDSketch {
/// Construct a `DDSketch`. Requires a `Config` specifying the parameters of the sketch
Expand Down
4 changes: 2 additions & 2 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl Store {
}

pub fn count(&self) -> u64 {
self.count as u64
self.count
}

pub fn merge(&mut self, other: &Store) {
Expand Down Expand Up @@ -203,7 +203,7 @@ impl Store {
collapse_end_index = collapse_start_index;
}

for key in (collapse_end_index as i32 + other.offset)..(other.max_key + 1) {
for key in (collapse_end_index + other.offset)..(other.max_key + 1) {
self.bins[(key - self.offset) as usize] += other.bins[(key - other.offset) as usize]
}

Expand Down
Loading