Skip to content

Commit

Permalink
chroe: fix compiler errors
Browse files Browse the repository at this point in the history
  • Loading branch information
evenyag committed Feb 23, 2024
1 parent a12321c commit ffa5354
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
5 changes: 5 additions & 0 deletions src/mito2/src/memtable/merge_tree/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,11 @@ impl DataParts {
}
}

pub(crate) fn with_frozen(mut self, frozen: Vec<DataPart>) -> Self {
self.frozen = frozen;
self
}

/// Writes a row into parts.
pub fn write_row(&mut self, pk_index: PkIndex, kv: KeyValue) {
self.active.write_row(pk_index, kv)
Expand Down
7 changes: 2 additions & 5 deletions src/mito2/src/memtable/merge_tree/partition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use store_api::storage::ColumnId;

use crate::error::Result;
use crate::memtable::key_values::KeyValue;
use crate::memtable::merge_tree::data::{DataBuffer, DataParts, DATA_INIT_CAP};
use crate::memtable::merge_tree::data::{DataParts, DATA_INIT_CAP};
use crate::memtable::merge_tree::metrics::WriteMetrics;
use crate::memtable::merge_tree::shard::Shard;
use crate::memtable::merge_tree::shard_builder::ShardBuilder;
Expand Down Expand Up @@ -207,10 +207,7 @@ impl Inner {
};

if inner.metadata.primary_key.is_empty() {
let data_parts = DataParts::new(
DataBuffer::with_capacity(inner.metadata.clone(), DATA_INIT_CAP),
Vec::new(),
);
let data_parts = DataParts::new(inner.metadata.clone(), DATA_INIT_CAP);
inner.shards.push(Shard::new(0, None, data_parts));
inner.active_shard_id = 1;
}
Expand Down
9 changes: 3 additions & 6 deletions src/mito2/src/memtable/merge_tree/shard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use store_api::metadata::RegionMetadataRef;

use crate::memtable::key_values::KeyValue;
use crate::memtable::merge_tree::data::{DataBuffer, DataParts, DATA_INIT_CAP};
use crate::memtable::merge_tree::data::{DataParts, DATA_INIT_CAP};
use crate::memtable::merge_tree::dict::KeyDictRef;
use crate::memtable::merge_tree::{PkId, ShardId};

Expand Down Expand Up @@ -77,10 +77,7 @@ impl Shard {
Shard {
shard_id: self.shard_id,
key_dict: self.key_dict.clone(),
data_parts: DataParts::new(
DataBuffer::with_capacity(metadata, DATA_INIT_CAP),
Vec::new(),
),
data_parts: DataParts::new(metadata, DATA_INIT_CAP),
}
}
}
Expand Down Expand Up @@ -147,7 +144,7 @@ mod tests {
}

let dict = dict_builder.finish().unwrap();
let data_parts = DataParts::new(DataBuffer::with_capacity(metadata, DATA_INIT_CAP), vec![]);
let data_parts = DataParts::new(metadata, DATA_INIT_CAP);

Shard::new(shard_id, Some(Arc::new(dict)), data_parts)
}
Expand Down
7 changes: 2 additions & 5 deletions src/mito2/src/memtable/merge_tree/shard_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ impl ShardBuilder {
};

// build data parts.
let data_parts = DataParts::new(
DataBuffer::with_capacity(metadata, DATA_INIT_CAP),
vec![data_part],
);
let data_parts = DataParts::new(metadata, DATA_INIT_CAP).with_frozen(vec![data_part]);
let key_dict = key_dict.map(Arc::new);

Ok(Some(Shard::new(shard_id, key_dict, data_parts)))
Expand Down Expand Up @@ -168,7 +165,7 @@ mod tests {
}

let dict = dict_builder.finish().unwrap();
let data_parts = DataParts::new(DataBuffer::with_capacity(metadata, DATA_INIT_CAP), vec![]);
let data_parts = DataParts::new(metadata, DATA_INIT_CAP);

Shard::new(shard_id, Some(Arc::new(dict)), data_parts)
}
Expand Down

0 comments on commit ffa5354

Please sign in to comment.