alamb commented on code in PR #754:
URL: 
https://github.com/apache/arrow-rs-object-store/pull/754#discussion_r3430292186


##########
src/integration.rs:
##########
@@ -1053,6 +1054,41 @@ pub async fn multipart(storage: &dyn ObjectStore, 
multipart: &dyn MultipartStore
     assert_eq!(meta.size, 0);
 }
 
+/// Tests [`MultipartStore::create_multipart_opts`]
+pub async fn multipart_with_opts(storage: &dyn ObjectStore, multipart: &dyn 
MultipartStore) {
+    let path = Path::from("test_multipart_with_opts");
+    let chunk_size = 5 * 1024 * 1024;
+    let chunks = get_chunks(chunk_size, 2);
+    let attributes =
+        Attributes::from_iter([(Attribute::Metadata("test_key".into()), 
"test_value")]);
+    let opts = PutMultipartOptions {
+        attributes: attributes.clone(),
+        ..Default::default()
+    };
+
+    let id = multipart.create_multipart_opts(&path, opts).await.unwrap();
+
+    let parts: Vec<_> = futures_util::stream::iter(chunks)
+        .enumerate()
+        .map(|(idx, b)| multipart.put_part(&path, &id, idx, b.into()))
+        .buffered(2)
+        .try_collect()
+        .await
+        .unwrap();
+
+    multipart
+        .complete_multipart(&path, &id, parts)
+        .await
+        .unwrap();
+
+    let result = storage.get(&path).await.unwrap();
+    assert_eq!(result.meta.size, chunk_size as u64 * 2);
+    // Some providers add default attributes, e.g. S3 may report a default 
Content-Type.

Review Comment:
   👍 



##########
src/gcp/mod.rs:
##########
@@ -236,6 +236,14 @@ impl MultipartStore for GoogleCloudStorage {
             .await
     }
 
+    async fn create_multipart_opts(
+        &self,
+        path: &Path,
+        opts: PutMultipartOptions,
+    ) -> Result<MultipartId> {
+        self.client.multipart_initiate(path, opts).await

Review Comment:
   This makes sense to me as `create_multipart` is simply passing in 
`PutMultipartOptions::default()` -- adding the options explicitly makes sense
   
   ```rust
       async fn create_multipart(&self, path: &Path) -> Result<MultipartId> {
           self.client
               .multipart_initiate(path, PutMultipartOptions::default())
               .await
       }
   ```



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