Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions crates/catalog/glue/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use iceberg::spec::{TableMetadata, TableMetadataBuilder};
use iceberg::table::Table;
use iceberg::{
Catalog, CatalogBuilder, Error, ErrorKind, MetadataLocation, Namespace, NamespaceIdent, Result,
TableCommit, TableCreation, TableIdent,
Runtime, TableCommit, TableCreation, TableIdent,
};
use iceberg_storage_opendal::OpenDalStorageFactory;

Expand All @@ -58,6 +58,7 @@ pub const GLUE_CATALOG_PROP_WAREHOUSE: &str = "warehouse";
pub struct GlueCatalogBuilder {
config: GlueCatalogConfig,
storage_factory: Option<Arc<dyn StorageFactory>>,
runtime: Runtime,
}

impl Default for GlueCatalogBuilder {
Expand All @@ -71,6 +72,7 @@ impl Default for GlueCatalogBuilder {
props: HashMap::new(),
},
storage_factory: None,
runtime: Runtime::default(),
}
}
}
Expand All @@ -83,6 +85,11 @@ impl CatalogBuilder for GlueCatalogBuilder {
self
}

fn with_runtime(mut self, runtime: Runtime) -> Self {
self.runtime = runtime;
self
}

fn load(
mut self,
name: impl Into<String>,
Expand Down Expand Up @@ -129,7 +136,7 @@ impl CatalogBuilder for GlueCatalogBuilder {
));
}

GlueCatalog::new(self.config, self.storage_factory).await
GlueCatalog::new(self.config, self.storage_factory, self.runtime).await
}
}
}
Expand All @@ -151,6 +158,7 @@ pub struct GlueCatalog {
config: GlueCatalogConfig,
client: GlueClient,
file_io: FileIO,
runtime: Runtime,
}

impl Debug for GlueCatalog {
Expand All @@ -166,6 +174,7 @@ impl GlueCatalog {
async fn new(
config: GlueCatalogConfig,
storage_factory: Option<Arc<dyn StorageFactory>>,
runtime: Runtime,
) -> Result<Self> {
let sdk_config = create_sdk_config(&config.props, config.uri.as_ref()).await;
let mut file_io_props = config.props.clone();
Expand Down Expand Up @@ -215,6 +224,7 @@ impl GlueCatalog {
config,
client: GlueClient(client),
file_io,
runtime,
})
}
/// Get the catalogs `FileIO`
Expand Down Expand Up @@ -273,6 +283,7 @@ impl GlueCatalog {
NamespaceIdent::new(db_name),
table_name.to_owned(),
))
.runtime(self.runtime.clone())
.build()?;

Ok((table, version_id))
Expand Down Expand Up @@ -612,6 +623,7 @@ impl Catalog for GlueCatalog {
.metadata_location(metadata_location_str)
.metadata(metadata)
.identifier(TableIdent::new(NamespaceIdent::new(db_name), table_name))
.runtime(self.runtime.clone())
.build()
}

Expand Down Expand Up @@ -846,6 +858,7 @@ impl Catalog for GlueCatalog {
.metadata_location(metadata_location)
.metadata(metadata)
.file_io(self.file_io())
.runtime(self.runtime.clone())
.build()?)
}

Expand Down
16 changes: 14 additions & 2 deletions crates/catalog/hms/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use iceberg::spec::{TableMetadata, TableMetadataBuilder};
use iceberg::table::Table;
use iceberg::{
Catalog, CatalogBuilder, Error, ErrorKind, MetadataLocation, Namespace, NamespaceIdent, Result,
TableCommit, TableCreation, TableIdent,
Runtime, TableCommit, TableCreation, TableIdent,
};
use volo_thrift::MaybeException;

Expand All @@ -56,6 +56,7 @@ pub const HMS_CATALOG_PROP_WAREHOUSE: &str = "warehouse";
pub struct HmsCatalogBuilder {
config: HmsCatalogConfig,
storage_factory: Option<Arc<dyn StorageFactory>>,
runtime: Runtime,
}

impl Default for HmsCatalogBuilder {
Expand All @@ -69,6 +70,7 @@ impl Default for HmsCatalogBuilder {
props: HashMap::new(),
},
storage_factory: None,
runtime: Runtime::default(),
}
}
}
Expand All @@ -81,6 +83,11 @@ impl CatalogBuilder for HmsCatalogBuilder {
self
}

fn with_runtime(mut self, runtime: Runtime) -> Self {
self.runtime = runtime;
self
}

fn load(
mut self,
name: impl Into<String>,
Expand Down Expand Up @@ -133,7 +140,7 @@ impl CatalogBuilder for HmsCatalogBuilder {
"Catalog warehouse is required",
))
} else {
HmsCatalog::new(self.config, self.storage_factory)
HmsCatalog::new(self.config, self.storage_factory, self.runtime)
}
};

Expand Down Expand Up @@ -169,6 +176,7 @@ pub struct HmsCatalog {
config: HmsCatalogConfig,
client: HmsClient,
file_io: FileIO,
runtime: Runtime,
}

impl Debug for HmsCatalog {
Expand All @@ -184,6 +192,7 @@ impl HmsCatalog {
fn new(
config: HmsCatalogConfig,
storage_factory: Option<Arc<dyn StorageFactory>>,
runtime: Runtime,
) -> Result<Self> {
let address = config
.address
Expand Down Expand Up @@ -223,6 +232,7 @@ impl HmsCatalog {
config,
client: HmsClient(client),
file_io,
runtime,
})
}
/// Get the catalogs `FileIO`
Expand Down Expand Up @@ -529,6 +539,7 @@ impl Catalog for HmsCatalog {
.metadata_location(metadata_location_str)
.metadata(metadata)
.identifier(TableIdent::new(NamespaceIdent::new(db_name), table_name))
.runtime(self.runtime.clone())
.build()
}

Expand Down Expand Up @@ -567,6 +578,7 @@ impl Catalog for HmsCatalog {
NamespaceIdent::new(db_name),
table.name.clone(),
))
.runtime(self.runtime.clone())
.build()
}

Expand Down
Loading
Loading