chitralverma opened a new issue, #9029:
URL: https://github.com/apache/opendal/issues/9029

   ### OpenDAL version or commit
   
   main (8e04c75b7)
   
   ### Affected service or component
   
   services/hdfs-native
   
   ### Describe the bug
   
   `hdfs-native` does not report `write_with_if_not_exists`, so 
`write_with(path).if_not_exists(true)` fails with `Unsupported`. The NameNode 
supports the operation: `create` without the overwrite flag fails with 
`FileAlreadyExistsException` when the file exists, and the check and the create 
are one RPC.
   
   Applications that ask for exclusive creation cannot write to HDFS. For 
example, DuckDB v2.0 asks for it on every `COPY TO` of a path that does not 
exist yet.
   
   ### Steps to Reproduce
   
   ```rust
   let op = Operator::from_uri("hdfs-native://127.0.0.1:9000/")?;
   op.write_with("new-file", "data").if_not_exists(true).await?;
   ```
   
   ### Expected Behavior
   
   The first write creates the file. A second write to the same path fails with 
`ConditionNotMatch`.
   
   ### Additional Context
   
   The fs, s3, gcs, azblob and memory services already report 
`write_with_if_not_exists`.
   
   ### Are you willing to submit a PR to fix this bug?
   
   - [x] Yes, I would like to submit a PR.
   


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