-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: finish read/write for single shard #17
feat: finish read/write for single shard #17
Conversation
|
||
impl Iterator for Iter { | ||
type Item = Result<DataBatch>; | ||
|
||
fn next(&mut self) -> Option<Self::Item> { | ||
todo!() | ||
while let Some(mut top) = self.heap.pop() { | ||
if top.source.is_valid() { |
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.
We can guarantee nodes in the heap are valid so we don't need this check.
@@ -186,6 +335,8 @@ impl DataBuffer { | |||
}) | |||
.push_value_ref(field); | |||
} | |||
|
|||
self.ts_builder.len() >= self.freeze_threshold |
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.
Maybe we should provide a len()
method and check this outside of the buffer. Then we don't need to store the threshold in the buffer.
offset: 0, | ||
current_data_batch: None, | ||
}; | ||
iter.next(); // fill data batch for comparison and merge. |
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.
next()
returns a result. We should handle it or change the return value of next()
.
I plan to merge it first. |
I hereby agree to the terms of the GreptimeDB CLA
What's changed and what's your intention?
This PR implements the iter method for
DataParts
. The iterator is simply a merge reader that compares the pk from both active and frozen parts ofDataParts
and merges thoseDataBatch
es with same pk index.Also
freeze
will be triggered on write path of the num of rows inside active data buffer exceedsfreeze_threshold
inMergeTreeConfig
.Checklist
Refer to a related PR or issue link (optional)