Skip to content

Commit e116fb0

Browse files
committed
partial restore
1 parent c822dcc commit e116fb0

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/query/service/src/pipelines/processors/transforms/window/partition/transform_hilbert_collect.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ impl Processor for TransformHilbertCollect {
211211
}
212212
State::Flush => {
213213
if let Some((partition_id, data_block)) = self.immediate_output_blocks.pop() {
214-
let mut restored_data_blocks = self.buffer.restore_by_id(partition_id).await?;
214+
let mut restored_data_blocks =
215+
self.buffer.restore_by_id(partition_id, true).await?;
215216
restored_data_blocks.push(data_block);
216217
self.state = State::Concat(restored_data_blocks);
217218
}

src/query/service/src/pipelines/processors/transforms/window/partition/window_partition_buffer.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,19 @@ impl WindowPartitionBuffer {
145145
while self.next_to_restore_partition_id + 1 < self.num_partitions as isize {
146146
self.next_to_restore_partition_id += 1;
147147
let partition_id = self.next_to_restore_partition_id as usize;
148-
let result = self.restore_by_id(partition_id).await?;
148+
let result = self.restore_by_id(partition_id, false).await?;
149149
if !result.is_empty() {
150150
return Ok(result);
151151
}
152152
}
153153
Ok(vec![])
154154
}
155155

156-
pub async fn restore_by_id(&mut self, partition_id: usize) -> Result<Vec<DataBlock>> {
156+
pub async fn restore_by_id(
157+
&mut self,
158+
partition_id: usize,
159+
partial_restore: bool,
160+
) -> Result<Vec<DataBlock>> {
157161
// Restore large partitions from spilled files.
158162
let mut result = self.spiller.take_spilled_partition(&partition_id).await?;
159163

@@ -171,7 +175,7 @@ impl WindowPartitionBuffer {
171175
location,
172176
partitions,
173177
} = merged_partitions;
174-
if out_of_memory_limit || *partial_restored {
178+
if out_of_memory_limit || *partial_restored || partial_restore {
175179
if let Some(pos) = partitions.iter().position(|(id, _)| *id == partition_id) {
176180
let data_block = self
177181
.spiller

src/query/storages/fuse/src/io/write/stream/block_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl StreamBlockBuilder {
242242
self.row_count >= self.properties.block_thresholds.min_rows_per_block
243243
|| self.block_size >= self.properties.block_thresholds.max_bytes_per_block
244244
|| (file_size >= self.properties.block_thresholds.min_compressed_per_block
245-
&& self.block_size >= self.properties.block_thresholds.min_bytes_per_block)
245+
&& self.block_size >= self.properties.block_thresholds.min_bytes_per_block)
246246
}
247247

248248
pub fn write(&mut self, block: DataBlock) -> Result<()> {

0 commit comments

Comments
 (0)