Skip to content

Commit

Permalink
fix: fix empty ops case in iceberg sink (#12811)
Browse files Browse the repository at this point in the history
Co-authored-by: ZENOTME <[email protected]>
  • Loading branch information
ZENOTME and ZENOTME authored Oct 12, 2023
1 parent a36d3c0 commit c0f9b80
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/connector/src/sink/iceberg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ impl UpsertWriter {
}

fn partition_ops(ops: &[Op]) -> Vec<(usize, usize)> {
assert!(!ops.is_empty());
let mut res = vec![];
let mut start = 0;
let mut prev_op = ops[0];
Expand All @@ -560,6 +561,9 @@ impl UpsertWriter {

pub async fn write(&mut self, chunk: StreamChunk) -> Result<()> {
let (chunk, ops) = chunk.compact().into_parts();
if ops.len() == 0 {
return Ok(());
}
let chunk = to_record_batch_with_schema(self.schema.clone(), &chunk.compact())
.map_err(|err| SinkError::Iceberg(anyhow!(err)))?;
let ranges = Self::partition_ops(&ops);
Expand Down

0 comments on commit c0f9b80

Please sign in to comment.