blackmwk commented on code in PR #2216:
URL: https://github.com/apache/iceberg-rust/pull/2216#discussion_r2893243901


##########
crates/storage/opendal/src/lib.rs:
##########
@@ -400,6 +402,30 @@ impl Storage for OpenDalStorage {
         Ok(op.remove_all(&path).await.map_err(from_opendal_error)?)
     }
 
+    async fn delete_stream(&self, mut paths: BoxStream<'static, String>) -> 
Result<()> {
+        // Get the first path to create the operator
+        let Some(first_path) = paths.next().await else {
+            return Ok(());
+        };
+
+        let storage = self.clone();
+        let (op, first_relative) = self.create_operator(&first_path)?;
+
+        // Create a stream of relative paths, starting with the first one
+        let relative_paths = futures::stream::once(async move { 
first_relative.to_string() })
+            .chain(paths.map(move |path| {
+                let (_, relative_path) = storage
+                    .create_operator(&path)

Review Comment:
   This seems quite expensive, we create operator for each path?



##########
crates/storage/opendal/src/lib.rs:
##########


Review Comment:
   We need to tests for opendal.



##########
crates/storage/opendal/src/lib.rs:
##########
@@ -400,6 +402,30 @@ impl Storage for OpenDalStorage {
         Ok(op.remove_all(&path).await.map_err(from_opendal_error)?)
     }
 
+    async fn delete_stream(&self, mut paths: BoxStream<'static, String>) -> 
Result<()> {
+        // Get the first path to create the operator
+        let Some(first_path) = paths.next().await else {
+            return Ok(());
+        };
+
+        let storage = self.clone();
+        let (op, first_relative) = self.create_operator(&first_path)?;
+
+        // Create a stream of relative paths, starting with the first one
+        let relative_paths = futures::stream::once(async move { 
first_relative.to_string() })
+            .chain(paths.map(move |path| {
+                let (_, relative_path) = storage
+                    .create_operator(&path)
+                    .expect("Failed to create operator");

Review Comment:
   We should not panic here.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to