suyanhanx commented on code in PR #3600:
URL:
https://github.com/apache/incubator-opendal/pull/3600#discussion_r1396774344
##########
core/src/services/hdfs/backend.rs:
##########
@@ -219,20 +219,37 @@ impl Accessor for HdfsBackend {
async fn write(&self, path: &str, op: OpWrite) -> Result<(RpWrite,
Self::Writer)> {
let p = build_rooted_abs_path(&self.root, path);
- let parent = PathBuf::from(&p)
- .parent()
- .ok_or_else(|| {
- Error::new(
- ErrorKind::Unexpected,
- "path should have parent but not, it must be malformed",
- )
- .with_context("input", &p)
- })?
- .to_path_buf();
-
- self.client
- .create_dir(&parent.to_string_lossy())
- .map_err(new_std_io_error)?;
+ if let Err(err) = self.client.metadata(&p) {
+ // Early return if other error happened.
+ if err.kind() != io::ErrorKind::NotFound {
+ return Err(new_std_io_error(err));
+ }
+
+ let parent = PathBuf::from(&p)
Review Comment:
It is the `crate::raw::path::get_parent`.
--
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]