fix: Fix wrong split pruning on timestamp#70
Merged
Conversation
Signed-off-by: Darkheir <raphael.cohen@sekoia.io>
There was a problem hiding this comment.
Pull request overview
Fixes incorrect split pruning when sorting by timestamp descending by aligning worst-hit timestamp bucketing with how split timestamp bounds are stored, preventing splits from being pruned when they may contain better (newer) documents within the same second.
Changes:
- Update
CanSplitDoBetter::record_new_worst_hitforSplitTimestampHigher/FindTraceIdsAggregationto use second truncation consistent with split metadata (avoids false pruning around sub-second boundaries). - Add a regression test covering a sub-second worst-hit scenario to ensure a split in the same second is not incorrectly pruned.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1198
to
+1202
| // Split timestamp_end is stored as floor(doc_nanos / 1e9). To avoid | ||
| // pruning a split that straddles the worst-hit boundary (e.g. worst | ||
| // hit at 1.5 s, split timestamp_end = 1 s, but split contains a doc | ||
| // at 1.7 s), we must use floor here as well, not div_ceil. | ||
| *timestamp = Some(timestamp_ns / 1_000_000_000); |
Collaborator
Author
There was a problem hiding this comment.
I'm not sure we can have negative timestamps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Some splits may be pruned containing documents that should be included in the response
How was this PR tested?
Describe how you tested this PR.