Skip to content

Commit

Permalink
fix(query): double panic if broken state in block builder (#17091)
Browse files Browse the repository at this point in the history
* fix(query): fix call double finish in transform accumulating

* fix(query): fix DataBlock corrupted, column length mismatch panic

* fix(query): remove useless file
  • Loading branch information
zhang2014 authored Dec 20, 2024
1 parent d8b7d4d commit f7a4a5d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ impl<T: AccumulatingTransform + 'static> Drop for AccumulatingTransformer<T> {
fn drop(&mut self) {
drop_guard(move || {
if !self.called_on_finish {
self.called_on_finish = true;
self.inner.on_finish(false).unwrap();
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,6 @@ pub fn sort_merge(
for block in data_blocks {
processor.transform(block)?;
}

processor.on_finish(true)
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ impl AccumulatingTransform for BlockBuilder {
Ok(blocks)
}

fn on_finish(&mut self, _output: bool) -> Result<Vec<DataBlock>> {
self.flush_block(true)
fn on_finish(&mut self, output: bool) -> Result<Vec<DataBlock>> {
if output {
return self.flush_block(true);
}

Ok(vec![])
}
}

0 comments on commit f7a4a5d

Please sign in to comment.