rchowell commented on code in PR #2338:
URL: https://github.com/apache/iceberg-rust/pull/2338#discussion_r3089957603
##########
crates/storage/opendal/src/resolving.rs:
##########
@@ -317,3 +315,54 @@ impl Storage for OpenDalResolvingStorage {
))
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ /// Builds a resolving storage with empty props, suitable for `resolve()`
+ /// calls that don't actually hit any backend.
+ fn empty_resolving_storage() -> OpenDalResolvingStorage {
+ OpenDalResolvingStorage {
+ props: HashMap::new(),
+ storages: RwLock::new(HashMap::new()),
+ #[cfg(feature = "opendal-s3")]
+ customized_credential_load: None,
+ }
+ }
+
+ #[cfg(feature = "opendal-s3")]
+ #[test]
+ fn test_resolve_s3_aliases_share_instance() {
+ let storage = empty_resolving_storage();
+
+ // All three S3-family schemes must collapse to a single cached
+ // `Arc<OpenDalStorage>` so that catalogs handing the resolver a mix
+ // of `s3://`, `s3a://`, `s3n://` paths don't rebuild operators.
+ let a = storage.resolve("s3://bucket/key").unwrap();
+ let b = storage.resolve("s3a://bucket/key").unwrap();
+ let c = storage.resolve("s3n://bucket/key").unwrap();
+
+ assert!(Arc::ptr_eq(&a, &b), "s3 and s3a should share one instance");
+ assert!(Arc::ptr_eq(&a, &c), "s3 and s3n should share one instance");
+ }
+
+ #[cfg(feature = "opendal-azdls")]
+ #[test]
+ fn test_resolve_azdls_aliases_share_instance() {
+ let storage = empty_resolving_storage();
+
+ let path_for = |scheme: &str| {
+
format!("{scheme}://[email protected]/path/to/file.parquet")
+ };
+
+ // All four Azure schemes collapse onto one cached instance.
Review Comment:
```suggestion
// All Azure schemes collapse onto one cached instance.
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]