From 55ee7c7a8f9e212d8440939429db8d548996d6e9 Mon Sep 17 00:00:00 2001 From: Dylan Chen Date: Tue, 27 Aug 2024 22:19:47 +0800 Subject: [PATCH] fix --- src/connector/src/sink/iceberg/mod.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/connector/src/sink/iceberg/mod.rs b/src/connector/src/sink/iceberg/mod.rs index afd1526b90da2..a7b88aa65e638 100644 --- a/src/connector/src/sink/iceberg/mod.rs +++ b/src/connector/src/sink/iceberg/mod.rs @@ -763,19 +763,20 @@ impl Sink for IcebergSink { const SINK_NAME: &'static str = ICEBERG_SINK; fn is_sink_decouple(desc: &SinkDesc, user_specified: &SinkDecouple) -> Result { - let commit_checkpoint_interval = - if let Some(interval) = desc.properties.get("commit_checkpoint_interval") { + let commit_checkpoint_interval = desc.properties + .get("commit_checkpoint_interval") + .map(|interval| { interval .parse::() .unwrap_or(DEFAULT_COMMIT_CHECKPOINT_INTERVAL) - } else { - DEFAULT_COMMIT_CHECKPOINT_INTERVAL - }; + }); match user_specified { SinkDecouple::Default | SinkDecouple::Enable => Ok(true), SinkDecouple::Disable => { - if commit_checkpoint_interval > 1 { + if let Some(commit_checkpoint_interval) = commit_checkpoint_interval + && commit_checkpoint_interval > 1 + { return Err(SinkError::Config(anyhow!( "config conflict: Iceberg config `commit_checkpoint_interval` larger than 1 means that sink decouple must be enabled, but session config sink_decouple is disabled" )));