Skip to content

Commit 13274d1

Browse files
CTTYgbrgr
authored andcommitted
refactor!(storage): Move OpenDal Storage to a new crate iceberg-storage-opendal (apache#2207)
<!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes apache#123` indicates that this PR will close issue apache#123. --> - Closes apache#2209 - Moved OpenDal Storage impl to a new crate iceberg-storage-opendal(crates/storage/opendal) - Renamed feature flags `storage-s3`, `storage-xxx` to `opendal-s3`, `opendal-xxx` <!-- Provide a summary of the modifications in this PR. List the main changes such as new features, bug fixes, refactoring, or any other updates. --> Relying on the existing uts <!-- Specify what test covers (unit test, integration test, etc.). If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? -->
1 parent 05279b4 commit 13274d1

34 files changed

Lines changed: 1584 additions & 47 deletions

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
# Order here is sensitive, as it will be used to determine the order of publishing
4040
package:
4141
- "crates/iceberg"
42+
- "crates/storage/opendal"
4243
- "crates/catalog/glue"
4344
- "crates/catalog/hms"
4445
- "crates/catalog/rest"

Cargo.lock

Lines changed: 24 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ members = [
2424
"crates/integration_tests",
2525
"crates/integrations/*",
2626
"crates/sqllogictest",
27+
"crates/storage/*",
2728
"crates/test_utils",
2829
]
2930
resolver = "2"
@@ -59,6 +60,7 @@ backon = "1.5.1"
5960
base64 = "0.22.1"
6061
bimap = "0.6"
6162
bytes = "1.11"
63+
cfg-if = "1"
6264
chrono = "0.4.41"
6365
clap = { version = "4.5.48", features = ["derive", "cargo"] }
6466
dashmap = "6"
@@ -85,6 +87,7 @@ iceberg-catalog-rest = { version = "0.8.0", path = "./crates/catalog/rest" }
8587
iceberg-catalog-s3tables = { version = "0.8.0", path = "./crates/catalog/s3tables" }
8688
iceberg-catalog-sql = { version = "0.8.0", path = "./crates/catalog/sql" }
8789
iceberg-datafusion = { version = "0.8.0", path = "./crates/integrations/datafusion" }
90+
iceberg-storage-opendal = { version = "0.8.0", path = "./crates/storage/opendal" }
8891
indicatif = "0.18"
8992
itertools = "0.13"
9093
libtest-mimic = "0.8.1"

bindings/python/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ crate-type = ["cdylib"]
3333
[dependencies]
3434
arrow = { version = "57.1", features = ["pyarrow", "chrono-tz"] }
3535
iceberg = { path = "../../crates/iceberg" }
36+
iceberg-storage-opendal = { path = "../../crates/storage/opendal", features = ["opendal-s3", "opendal-fs", "opendal-memory"] }
3637
pyo3 = { version = "0.26", features = ["extension-module", "abi3-py310"] }
3738
iceberg-datafusion = { path = "../../crates/integrations/datafusion" }
3839
datafusion-ffi = { version = "52.1" }

bindings/python/src/datafusion_table_provider.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ use std::sync::Arc;
2222
use datafusion_ffi::proto::logical_extension_codec::FFI_LogicalExtensionCodec;
2323
use datafusion_ffi::table_provider::FFI_TableProvider;
2424
use iceberg::TableIdent;
25-
use iceberg::io::{FileIOBuilder, OpenDalStorageFactory, StorageFactory};
25+
use iceberg::io::{FileIOBuilder, StorageFactory};
2626
use iceberg::table::StaticTable;
2727
use iceberg_datafusion::table::IcebergStaticTableProvider;
28+
use iceberg_storage_opendal::OpenDalStorageFactory;
2829
use pyo3::exceptions::{PyRuntimeError, PyValueError};
2930
use pyo3::prelude::{PyAnyMethods, PyCapsuleMethods, *};
3031
use pyo3::types::{PyAny, PyCapsule};

crates/catalog/glue/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ async-trait = { workspace = true }
3434
aws-config = { workspace = true }
3535
aws-sdk-glue = { workspace = true }
3636
iceberg = { workspace = true }
37+
iceberg-storage-opendal = { workspace = true, features = ["opendal-s3"] }
3738
serde_json = { workspace = true }
3839
tokio = { workspace = true }
3940
tracing = { workspace = true }

crates/catalog/glue/src/catalog.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ use aws_sdk_glue::operation::create_table::CreateTableError;
2525
use aws_sdk_glue::operation::update_table::UpdateTableError;
2626
use aws_sdk_glue::types::TableInput;
2727
use iceberg::io::{
28-
FileIO, FileIOBuilder, OpenDalStorageFactory, S3_ACCESS_KEY_ID, S3_ENDPOINT, S3_REGION,
29-
S3_SECRET_ACCESS_KEY, S3_SESSION_TOKEN, StorageFactory,
28+
FileIO, FileIOBuilder, S3_ACCESS_KEY_ID, S3_ENDPOINT, S3_REGION, S3_SECRET_ACCESS_KEY,
29+
S3_SESSION_TOKEN, StorageFactory,
3030
};
3131
use iceberg::spec::{TableMetadata, TableMetadataBuilder};
3232
use iceberg::table::Table;
3333
use iceberg::{
3434
Catalog, CatalogBuilder, Error, ErrorKind, MetadataLocation, Namespace, NamespaceIdent, Result,
3535
TableCommit, TableCreation, TableIdent,
3636
};
37+
use iceberg_storage_opendal::OpenDalStorageFactory;
3738

3839
use crate::error::{from_aws_build_error, from_aws_sdk_error};
3940
use crate::utils::{

crates/catalog/glue/tests/glue_catalog_test.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
use std::collections::HashMap;
2424
use std::sync::Arc;
2525

26-
use iceberg::io::{
27-
FileIOBuilder, OpenDalStorageFactory, S3_ACCESS_KEY_ID, S3_ENDPOINT, S3_REGION,
28-
S3_SECRET_ACCESS_KEY,
29-
};
26+
use iceberg::io::{FileIOBuilder, S3_ACCESS_KEY_ID, S3_ENDPOINT, S3_REGION, S3_SECRET_ACCESS_KEY};
3027
use iceberg::spec::{NestedField, PrimitiveType, Schema, Type};
3128
use iceberg::transaction::{ApplyTransactionAction, Transaction};
3229
use iceberg::{
@@ -36,6 +33,7 @@ use iceberg_catalog_glue::{
3633
AWS_ACCESS_KEY_ID, AWS_REGION_NAME, AWS_SECRET_ACCESS_KEY, GLUE_CATALOG_PROP_URI,
3734
GLUE_CATALOG_PROP_WAREHOUSE, GlueCatalog, GlueCatalogBuilder,
3835
};
36+
use iceberg_storage_opendal::OpenDalStorageFactory;
3937
use iceberg_test_utils::{
4038
cleanup_namespace, get_glue_endpoint, get_minio_endpoint, normalize_test_name_with_parts,
4139
set_up,

crates/catalog/hms/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ motore-macros = { workspace = true }
5454
volo = { workspace = true }
5555

5656
[dev-dependencies]
57+
iceberg-storage-opendal = { workspace = true, features = ["opendal-s3"] }
5758
iceberg_test_utils = { path = "../../test_utils", features = ["tests"] }
5859

5960
[package.metadata.cargo-machete]

crates/catalog/hms/tests/hms_catalog_test.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,14 @@
2323
use std::collections::HashMap;
2424
use std::sync::Arc;
2525

26-
use iceberg::io::{
27-
FileIOBuilder, OpenDalStorageFactory, S3_ACCESS_KEY_ID, S3_ENDPOINT, S3_REGION,
28-
S3_SECRET_ACCESS_KEY,
29-
};
26+
use iceberg::io::{FileIOBuilder, S3_ACCESS_KEY_ID, S3_ENDPOINT, S3_REGION, S3_SECRET_ACCESS_KEY};
3027
use iceberg::spec::{NestedField, PrimitiveType, Schema, Type};
3128
use iceberg::{Catalog, CatalogBuilder, Namespace, NamespaceIdent, TableCreation, TableIdent};
3229
use iceberg_catalog_hms::{
3330
HMS_CATALOG_PROP_THRIFT_TRANSPORT, HMS_CATALOG_PROP_URI, HMS_CATALOG_PROP_WAREHOUSE,
3431
HmsCatalog, HmsCatalogBuilder, THRIFT_TRANSPORT_BUFFERED,
3532
};
33+
use iceberg_storage_opendal::OpenDalStorageFactory;
3634
use iceberg_test_utils::{
3735
cleanup_namespace, get_hms_endpoint, get_minio_endpoint, normalize_test_name_with_parts, set_up,
3836
};

0 commit comments

Comments
 (0)