xushiyan commented on code in PR #457:
URL: https://github.com/apache/hudi-rs/pull/457#discussion_r2403577837
##########
crates/core/src/storage/util.rs:
##########
@@ -43,6 +43,22 @@ pub fn get_scheme_authority(url: &Url) -> String {
format!("{}://{}", url.scheme(), url.authority())
}
+/// Converts backslashes to forward slashes for cross-platform compatibility.
+pub fn normalize_path_for_storage(path: &str) -> String {
+ path.replace('\\', "/")
+}
+
+/// Joins path segments with forward slashes.
+pub fn join_storage_path(segments: &[&str]) -> String {
+ let joined = segments
+ .iter()
+ .map(|s| s.trim_matches('/').trim_matches('\\'))
+ .filter(|s| !s.is_empty())
+ .collect::<Vec<_>>()
+ .join("/");
+ normalize_path_for_storage(&joined)
Review Comment:
we don't want to maintain such conversion. see if we can leverage object
store API which should have already handled the paths. see
https://docs.rs/object_store/latest/object_store/path/struct.Path.html#method.from_filesystem_path
basically we need to handle 1) local fs paths concatenation which rust's
std::path should work 2) for cloud store paths, we always handle it with object
store APIs
--
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]