mmodzelewski commented on code in PR #2605:
URL: https://github.com/apache/iggy/pull/2605#discussion_r2726679175


##########
Cargo.toml:
##########
@@ -133,8 +133,8 @@ futures-util = "0.3.31"
 human-repr = "1.1.0"
 humantime = "2.3.0"
 hwlocality = "1.0.0-alpha.11"
-iceberg = "=0.6.0"
-iceberg-catalog-rest = "=0.6.0"
+iceberg = "0.8.0"
+iceberg-catalog-rest = "=0.8.0"

Review Comment:
   if iceberg's version is no longer locked to an exact version, can we unlock 
this one as well?



##########
core/connectors/sinks/iceberg_sink/src/catalog.rs:
##########
@@ -18,24 +18,35 @@
 
 use super::{Error, IcebergSinkConfig, IcebergSinkTypes};
 use crate::props::init_props;
-use iceberg::Catalog;
-use iceberg_catalog_rest::{RestCatalog, RestCatalogConfig};
+use iceberg::{Catalog, CatalogBuilder};
+use iceberg_catalog_rest::{
+    REST_CATALOG_PROP_URI, REST_CATALOG_PROP_WAREHOUSE, RestCatalog, 
RestCatalogBuilder,
+};
 use std::collections::HashMap;
 
 pub async fn init_catalog(config: &IcebergSinkConfig) -> Result<Box<dyn 
Catalog>, Error> {
     let props = init_props(config)?;
     match config.catalog_type {
-        IcebergSinkTypes::REST => Ok(Box::new(get_rest_catalog(config, 
props))),
+        IcebergSinkTypes::REST => Ok(Box::new(get_rest_catalog(config, 
props).await)),
     }
 }
 
 #[inline(always)]
-fn get_rest_catalog(config: &IcebergSinkConfig, props: HashMap<String, 
String>) -> RestCatalog {
-    let catalog_config = RestCatalogConfig::builder()
-        .uri(config.uri.clone())
-        .props(props.clone())
-        .warehouse(config.warehouse.clone())
-        .build();
+async fn get_rest_catalog(
+    config: &IcebergSinkConfig,
+    props: HashMap<String, String>,
+) -> RestCatalog {
+    let mut new_props = HashMap::from([
+        (REST_CATALOG_PROP_URI.to_string(), config.uri.clone()),
+        (
+            REST_CATALOG_PROP_WAREHOUSE.to_string(),
+            config.warehouse.clone(),
+        ),
+    ]);
+    new_props.extend(props);
 
-    RestCatalog::new(catalog_config)
+    RestCatalogBuilder::default()
+        .load("rest", new_props)
+        .await
+        .unwrap()

Review Comment:
   let's propagate the error instead of unwrapping



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to