Skip to content

Commit

Permalink
feat(sink): merge small chunks for sink executor (#17825) (#17847)
Browse files Browse the repository at this point in the history
Co-authored-by: Dylan <[email protected]>
  • Loading branch information
github-actions[bot] and chenzl25 authored Jul 30, 2024
1 parent 0a99c93 commit eb12ef0
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/stream/src/executor/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,20 +355,32 @@ impl<F: LogStoreFactory> SinkExecutor<F> {
} else {
chunks
};
let chunks = if re_construct_with_sink_pk {
StreamChunkCompactor::new(down_stream_pk.clone(), chunks)
if re_construct_with_sink_pk {
let chunks = StreamChunkCompactor::new(down_stream_pk.clone(), chunks)
.reconstructed_compacted_chunks(
chunk_size,
input_data_types.clone(),
sink_type != SinkType::ForceAppendOnly,
)
);
for c in chunks {
yield Message::Chunk(c);
}
} else {
chunks
let mut chunk_builder =
StreamChunkBuilder::new(chunk_size, input_data_types.clone());
for chunk in chunks {
for (op, row) in chunk.rows() {
if let Some(c) = chunk_builder.append_row(op, row) {
yield Message::Chunk(c);
}
}
}

if let Some(c) = chunk_builder.take() {
yield Message::Chunk(c);
}
};

for c in chunks {
yield Message::Chunk(c);
}
if let Some(w) = mem::take(&mut watermark) {
yield Message::Watermark(w)
}
Expand Down

0 comments on commit eb12ef0

Please sign in to comment.