Skip to content

Commit fda82a2

Browse files
authored
refactor(storage): remove the configured_scheme parameter from storage impls (#2338)
## Which issue does this PR close? - Closes #2245 - Related #2231 ## What changes are included in this PR? - Remove configured_scheme field from OpenDalStorage::{S3,Azdls} - Make S3 storage use the scheme in the file paths, allowing for custom S3-compatible schemes like minio:// - Use `HashMap<Scheme, Arc<OpenDalStorage>>` so aliases share a storage instance - Added new unit tests and removed some now-obsolete scheme-mismatch tests ## Break Change We are removing a struct field from public types, so this would need to be release in 0.10.0 ```rust // Before OpenDalStorageFactory::S3 { configured_scheme: "s3a".to_string(), customized_credential_load: None, } OpenDalStorageFactory::Azdls { configured_scheme: AzureStorageScheme::Abfss, } // After OpenDalStorageFactory::S3 { customized_credential_load: None } OpenDalStorageFactory::Azdls ``` ## Are these changes tested? Beyond the unit tests, I ran these integration tests. ```sh docker compose -f dev/docker-compose.yaml up -d --wait # requires unset on any AWS_ env vars cargo test -p iceberg-integration-tests cargo test -p iceberg-catalog-hms --test hms_catalog_test cargo test -p iceberg-catalog-loader cargo test -p iceberg-storage-opendal --features opendal-s3 --test file_io_s3_test ```
1 parent 4e8cf7f commit fda82a2

14 files changed

Lines changed: 116 additions & 163 deletions

File tree

crates/catalog/glue/src/catalog.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ impl GlueCatalog {
203203
// Use provided factory or default to OpenDalStorageFactory::S3
204204
let factory = storage_factory.unwrap_or_else(|| {
205205
Arc::new(OpenDalStorageFactory::S3 {
206-
configured_scheme: "s3a".to_string(),
207206
customized_credential_load: None,
208207
})
209208
});

crates/catalog/hms/tests/hms_catalog_test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ async fn get_catalog() -> HmsCatalog {
6464

6565
// Wait for bucket to actually exist
6666
let file_io = FileIOBuilder::new(Arc::new(OpenDalStorageFactory::S3 {
67-
configured_scheme: "s3a".to_string(),
6867
customized_credential_load: None,
6968
}))
7069
.with_props(props.clone())
@@ -83,7 +82,6 @@ async fn get_catalog() -> HmsCatalog {
8382

8483
HmsCatalogBuilder::default()
8584
.with_storage_factory(Arc::new(OpenDalStorageFactory::S3 {
86-
configured_scheme: "s3a".to_string(),
8785
customized_credential_load: None,
8886
}))
8987
.load("hms", props)

crates/catalog/loader/tests/common/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ async fn glue_catalog() -> GlueCatalog {
233233
]);
234234

235235
let file_io = FileIOBuilder::new(Arc::new(OpenDalStorageFactory::S3 {
236-
configured_scheme: "s3a".to_string(),
237236
customized_credential_load: None,
238237
}))
239238
.with_props(props.clone())
@@ -285,7 +284,6 @@ async fn hms_catalog() -> HmsCatalog {
285284
]);
286285

287286
let file_io = FileIOBuilder::new(Arc::new(OpenDalStorageFactory::S3 {
288-
configured_scheme: "s3a".to_string(),
289287
customized_credential_load: None,
290288
}))
291289
.with_props(props.clone())
@@ -302,7 +300,6 @@ async fn hms_catalog() -> HmsCatalog {
302300

303301
HmsCatalogBuilder::default()
304302
.with_storage_factory(Arc::new(OpenDalStorageFactory::S3 {
305-
configured_scheme: "s3a".to_string(),
306303
customized_credential_load: None,
307304
}))
308305
.load("hms", props)

crates/catalog/s3tables/src/catalog.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ impl S3TablesCatalog {
202202
// Use provided factory or default to OpenDalStorageFactory::S3
203203
let factory = storage_factory.unwrap_or_else(|| {
204204
Arc::new(OpenDalStorageFactory::S3 {
205-
configured_scheme: "s3".to_string(),
206205
customized_credential_load: None,
207206
})
208207
});

crates/iceberg/src/catalog/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ pub trait CatalogBuilder: Default + Debug + Send + Sync {
144144
///
145145
/// let catalog = MyCatalogBuilder::default()
146146
/// .with_storage_factory(Arc::new(OpenDalStorageFactory::S3 {
147-
/// configured_scheme: "s3a".to_string(),
148147
/// customized_credential_load: None,
149148
/// }))
150149
/// .load("my_catalog", props)

crates/integration_tests/tests/common/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pub async fn random_ns() -> Namespace {
2828
let fixture = get_test_fixture();
2929
let rest_catalog = RestCatalogBuilder::default()
3030
.with_storage_factory(Arc::new(OpenDalStorageFactory::S3 {
31-
configured_scheme: "s3".to_string(),
3231
customized_credential_load: None,
3332
}))
3433
.load("rest", fixture.catalog_config.clone())

crates/integration_tests/tests/conflict_commit_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ async fn test_append_data_file_conflict() {
4343
let fixture = get_test_fixture();
4444
let rest_catalog = RestCatalogBuilder::default()
4545
.with_storage_factory(Arc::new(OpenDalStorageFactory::S3 {
46-
configured_scheme: "s3".to_string(),
4746
customized_credential_load: None,
4847
}))
4948
.load("rest", fixture.catalog_config.clone())

crates/integration_tests/tests/read_evolved_schema.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ async fn test_evolved_schema() {
3434
let fixture = get_test_fixture();
3535
let rest_catalog = RestCatalogBuilder::default()
3636
.with_storage_factory(Arc::new(OpenDalStorageFactory::S3 {
37-
configured_scheme: "s3".to_string(),
3837
customized_credential_load: None,
3938
}))
4039
.load("rest", fixture.catalog_config.clone())

crates/integration_tests/tests/read_positional_deletes.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ async fn test_read_table_with_positional_deletes() {
3030
let fixture = get_test_fixture();
3131
let rest_catalog = RestCatalogBuilder::default()
3232
.with_storage_factory(Arc::new(OpenDalStorageFactory::S3 {
33-
configured_scheme: "s3".to_string(),
3433
customized_credential_load: None,
3534
}))
3635
.load("rest", fixture.catalog_config.clone())

crates/storage/opendal/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ use iceberg_storage_opendal::OpenDalStorageFactory;
6161
async fn main() -> iceberg::Result<()> {
6262
let catalog = RestCatalogBuilder::default()
6363
.with_storage_factory(Arc::new(OpenDalStorageFactory::S3 {
64-
configured_scheme: "s3".to_string(),
6564
customized_credential_load: None,
6665
}))
6766
.load(

0 commit comments

Comments
 (0)