-
Notifications
You must be signed in to change notification settings - Fork 207
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: sort record batch of write request #1585
Conversation
horaedb/metric_engine/src/storage.rs
Outdated
.context("execute sort physical plan")?; | ||
|
||
let mut batches = Vec::new(); | ||
while let Some(batch) = stream.next().await { |
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.
The batch return from next()
may not equals input, there are no guarantees for that.
horaedb/metric_engine/src/storage.rs
Outdated
@@ -69,6 +79,7 @@ pub struct CloudObjectStorage { | |||
path: String, | |||
store: ObjectStoreRef, | |||
arrow_schema: SchemaRef, | |||
primary_key_indexs: Vec<usize>, |
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 think we use num_primary_key: usize
, it's more easier to use, and have no heap memory allocation.
0..num_primary_keys
columns are primary key.
9aab88b
to
9441536
Compare
horaedb/metric_engine/src/storage.rs
Outdated
let batch_plan = | ||
MemoryExec::try_new(&[vec![batch]], schema, None).context("build batch plan")?; | ||
let physical_plan = SortExec::new(physical_sort_exprs, Arc::new(batch_plan)); | ||
let mut stream = physical_plan |
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.
Please use collect to fetch results.
Your solution only works for single partition plan.
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
Rationale
Support sorted record batch of write request by primary key.
Detailed Changes
Test Plan