JingsongLi commented on code in PR #1465:
URL: https://github.com/apache/paimon-rust/pull/1465#discussion_r4678699127
##########
crates/paimon/src/io/file_io.rs:
##########
@@ -1769,6 +1810,49 @@ impl FileSource {
} => Ok((op.clone(), relative_path.clone(),
Some(cache_path.clone()))),
}
}
+
+ async fn resolve_for_write(
+ &self,
+ path: &str,
+ ) -> crate::Result<(Operator, String, Option<String>)> {
+ let parent = match self {
+ Self::Static {
+ op,
+ relative_path,
+ requires_parent_dir: true,
+ ..
+ } => relative_path
+ .trim_end_matches('/')
+ .rsplit_once('/')
+ .map(|(parent, _)| (op.clone(), parent.to_string())),
+ Self::Provider {
+ provider,
+ requires_parent_dir: true,
+ } => {
+ let path = path.trim_end_matches('/');
+ match path.rsplit_once('/') {
+ Some((parent, _)) if !parent.is_empty() &&
!parent.ends_with(":/") => {
+ Some(resolve_provider(provider.as_ref(),
&format!("{parent}/")).await?)
Review Comment:
**[P2] Preserve the ability to write a provider-mapped object directly**
Every public `FileIOProvider` now resolves a separate parent URI before
writing the requested file. A provider can map the exact requested object to an
operator without having a directory route. I exercised
`FileIO::new_output(...).write(...)` with an object that the provider resolves
and a backend that writes it directly. The write succeeds on `main`. Here it
fails with the unmapped parent URI before the object is resolved. Keep the
existing direct-write contract for generic providers. Use explicit parent
creation at call sites that require it, or make the extra directory operation
an explicit backend capability.
--
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]