Skip to content
Closed
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
1 change: 1 addition & 0 deletions .cargo/config.toml
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ This changelog should be updated as part of a PR if the work is worth noting (mo

**Full Changelog**: [TODO]

## [1.19.0](https://github.com/timescale/timescaledb-toolkit/releases/tag/1.19.0) (2024-11-14)

#### New experimental features

#### Bug fixes

#### Other notable changes

#### Shout-outs

**Full Changelog**: [TODO]

## [1.18.0](https://github.com/timescale/timescaledb-toolkit/releases/tag/1.18.0) (2023-11-28)

#### New experimental features
Expand Down
45 changes: 45 additions & 0 deletions crates/udd-sketch/src/compactor.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
use crate::swap::SwapBucket;
use crate::SketchHashKey::Invalid;
use crate::{SketchHashEntry, SketchHashKey, SketchHashMap};

#[inline]
pub fn compact_from_iter(
swap_iter: &mut impl Iterator<Item = SwapBucket>,
map: &mut SketchHashMap,
) {
let Some(mut current) = swap_iter.next() else {
return;
};

for next in swap_iter {
if next.key == Invalid {
break;
}

// This combines those buckets that compact into the same one
// For example, Positive(9) and Positive(8) both
// compact into Positive(4)
if current.key == next.key {
current.count += next.count;
} else {
map.map.insert(
current.key,
SketchHashEntry {
count: current.count,
next: next.key,
},
);
current = next;
}
}

// And the final one ...
map.map.insert(
current.key,
SketchHashEntry {
count: current.count,
next: Invalid,
},
);
map.head = map.head.compact_key();
}
Empty file.
Loading
Loading