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


##########
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:
   Done, thank you for catching this



-- 
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