Skip to content

Commit

Permalink
fix(batch): avoid empty chunk in source executor (#13046)
Browse files Browse the repository at this point in the history
  • Loading branch information
zwang28 committed Oct 25, 2023
1 parent 39f71a1 commit 726964a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/batch/src/executor/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ impl SourceExecutor {
for chunk in stream {
match chunk {
Ok(chunk) => {
yield covert_stream_chunk_to_batch_chunk(chunk.chunk)?;
let data_chunk = covert_stream_chunk_to_batch_chunk(chunk.chunk)?;
if data_chunk.capacity() > 0 {
yield data_chunk;
}
}
Err(e) => {
return Err(e);
Expand Down
7 changes: 6 additions & 1 deletion src/common/src/util/chunk_coalesce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,12 @@ impl SlicedDataChunk {
}

pub fn with_offset_checked(data_chunk: DataChunk, offset: usize) -> Self {
assert!(offset < data_chunk.capacity());
assert!(
offset < data_chunk.capacity(),
"offset {}, data_chunk capacity {}",
offset,
data_chunk.capacity()
);
Self { data_chunk, offset }
}

Expand Down

0 comments on commit 726964a

Please sign in to comment.