From e3c3c0db1246c61611e546c61a82e6e1481a25c6 Mon Sep 17 00:00:00 2001 From: William Wen <44139337+wenym1@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:31:48 +0800 Subject: [PATCH] fix(sink): avoid sinking empty stream chunk (#17511) --- src/stream/src/executor/sink.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/stream/src/executor/sink.rs b/src/stream/src/executor/sink.rs index e9e9eda31fb7e..9b6c84f674cfd 100644 --- a/src/stream/src/executor/sink.rs +++ b/src/stream/src/executor/sink.rs @@ -345,9 +345,15 @@ impl SinkExecutor { // Force append-only by dropping UPDATE/DELETE messages. We do this when the // user forces the sink to be append-only while it is actually not based on // the frontend derivation result. - delete_chunks.push(force_delete_only(c.clone())); + let chunk = force_delete_only(c.clone()); + if chunk.cardinality() > 0 { + delete_chunks.push(chunk); + } + } + let chunk = force_append_only(c); + if chunk.cardinality() > 0 { + insert_chunks.push(chunk); } - insert_chunks.push(force_append_only(c)); } delete_chunks .into_iter()