-
Notifications
You must be signed in to change notification settings - Fork 326
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
fix: clone data instead of moving it - homemade future is dangerous #3542
Merged
Conversation
This file contains 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
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
waynexia
commented
Mar 19, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3542 +/- ##
==========================================
- Coverage 85.37% 84.99% -0.38%
==========================================
Files 909 909
Lines 151812 151814 +2
==========================================
- Hits 129611 129036 -575
- Misses 22201 22778 +577 |
WenyXu
approved these changes
Mar 19, 2024
v0y4g3r
approved these changes
Mar 19, 2024
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.
LGTM, poll master
waynexia
commented
Mar 19, 2024
zhongzc
approved these changes
Mar 19, 2024
Possibly no clone solution - diff --git a/src/promql/src/extension_plan/series_divide.rs b/src/promql/src/extension_plan/series_divide.rs
index 73fffbdeeb..4bdd3dda56 100644
--- a/src/promql/src/extension_plan/series_divide.rs
+++ b/src/promql/src/extension_plan/series_divide.rs
@@ -255,17 +255,19 @@ impl Stream for SeriesDivideStream {
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
loop {
- if let Some(batch) = self.buffer.take() {
+ if let Some(batch) = self.buffer.as_ref() {
let same_length = self.find_first_diff_row(&batch) + 1;
if same_length >= batch.num_rows() {
let next_batch = match ready!(self.as_mut().fetch_next_batch(cx)) {
Some(Ok(next_batch)) => next_batch,
None => {
self.num_series += 1;
+ let batch = self.buffer.take().expect("must be some batch");
return Poll::Ready(Some(Ok(batch)));
}
error => return Poll::Ready(error),
};
+ let batch = self.buffer.take().expect("must be some batch");
let new_batch = compute::concat_batches(&batch.schema(), &[batch, next_batch])?;
self.buffer = Some(new_batch);
continue; ... while a new "unchecked" unwrap while the condition should hold. |
3 tasks
3 tasks
12 tasks
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.
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
What's changed and what's your intention?
Fix the change in #3537. Since
RecordBatch
is all wrapped byArc
, cloning it is not that unacceptable.Checklist