-
-
Notifications
You must be signed in to change notification settings - Fork 716
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
add Histogram aggregation #1306
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1306 +/- ##
==========================================
+ Coverage 94.08% 94.23% +0.15%
==========================================
Files 230 231 +1
Lines 39191 40758 +1567
==========================================
+ Hits 36872 38409 +1537
- Misses 2319 2349 +30
Continue to review full report at Codecov.
|
4cb8932
to
a88e260
Compare
.count(); | ||
let num_buckets = self.buckets.len(); | ||
|
||
let buckets = self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the saturating_sub tries to address the edge case, but that's a cryptic way to write code.
Buckets is a Vec... There is no need for magic tricks.
For instance, you could compute skip_end
first, working on the slice [skip_start..]
.
You could also, compute skip_end
first, and thank skip heading element and collect on the same iterator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you solved the riddle I can remove it ;)
I just realized we can simply filter all empty buckets.
Edit: I started with the slice, but here we want to get the elements by value to avoid clones
src/aggregation/mod.rs
Outdated
@@ -239,6 +248,10 @@ pub enum Key { | |||
F64(f64), | |||
} | |||
|
|||
trait MergeFruits { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this trait useful? I'm not sure I understand its point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it is used to share code in the merge_maps thingy?
Why is it not declared in intermediate_agg_result
then, close to that function then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, so multiple buckets can share the merge code on collections
I moved it to intermediate_agg_result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see inline comments.
pub(crate) struct SegmentHistogramBucketEntry { | ||
pub key: f64, | ||
pub doc_count: u64, | ||
pub sub_aggregation: Option<SegmentAggregationResultsCollector>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should also keep sub_aggregation as an external Vec<Option<SegmentAggregationResultsCollector>>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that's something I wanted to test as well, but I would probably go for Option<Vec<SegmentAggregationResultsCollector>>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it's much faster like that, 2x in some cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same file same comment. the code is needlessly complicated.
1a2dd86
to
521302a
Compare
.collect(), | ||
) | ||
impl AggregationResults { | ||
/// Convert and intermediate result and its aggregation request to the final result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very helpful
Co-authored-by: Paul Masurel <paul@quickwit.io>
Co-authored-by: Paul Masurel <paul@quickwit.io>
No description provided.