Skip to content

Commit 6069b6b

Browse files
committed
feat(catalog): implement catalog loader for glue (apache#1603)
## Which issue does this PR close? - Closes [apache#1259](apache#1259). ## What changes are included in this PR? * Added `GlueCatalogBuilder` * Implement `CatalogBuilder` trait for `GlueCatalogBuilder` * Include glue in loader ## Are these changes tested? Added in loader tests and updated glue integration tests
1 parent 73c5a01 commit 6069b6b

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

crates/catalog/glue/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ iceberg = { workspace = true }
3737
serde_json = { workspace = true }
3838
tokio = { workspace = true }
3939
tracing = { workspace = true }
40-
typed-builder = { workspace = true }
4140

4241
[dev-dependencies]
4342
ctor = { workspace = true }

crates/catalog/glue/src/catalog.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use iceberg::{
2929
Catalog, CatalogBuilder, Error, ErrorKind, MetadataLocation, Namespace, NamespaceIdent, Result,
3030
TableCommit, TableCreation, TableIdent,
3131
};
32-
use typed_builder::TypedBuilder;
3332

3433
use crate::error::{from_aws_build_error, from_aws_sdk_error};
3534
use crate::utils::{
@@ -117,21 +116,13 @@ impl CatalogBuilder for GlueCatalogBuilder {
117116
}
118117
}
119118

120-
#[derive(Debug, TypedBuilder)]
119+
#[derive(Debug)]
121120
/// Glue Catalog configuration
122-
pub struct GlueCatalogConfig {
123-
#[builder(default, setter(strip_option))]
121+
pub(crate) struct GlueCatalogConfig {
124122
name: Option<String>,
125-
126-
#[builder(default, setter(strip_option(fallback = uri_opt)))]
127123
uri: Option<String>,
128-
129-
#[builder(default, setter(strip_option(fallback = catalog_id_opt)))]
130124
catalog_id: Option<String>,
131-
132125
warehouse: String,
133-
134-
#[builder(default)]
135126
props: HashMap<String, String>,
136127
}
137128

crates/catalog/glue/tests/glue_catalog_test.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ use std::sync::RwLock;
2424
use ctor::{ctor, dtor};
2525
use iceberg::io::{S3_ACCESS_KEY_ID, S3_ENDPOINT, S3_REGION, S3_SECRET_ACCESS_KEY};
2626
use iceberg::spec::{NestedField, PrimitiveType, Schema, Type};
27-
use iceberg::{Catalog, Namespace, NamespaceIdent, Result, TableCreation, TableIdent};
27+
use iceberg::{
28+
Catalog, CatalogBuilder, Namespace, NamespaceIdent, Result, TableCreation, TableIdent,
29+
};
2830
use iceberg_catalog_glue::{
29-
AWS_ACCESS_KEY_ID, AWS_REGION_NAME, AWS_SECRET_ACCESS_KEY, GlueCatalog, GlueCatalogConfig,
31+
AWS_ACCESS_KEY_ID, AWS_REGION_NAME, AWS_SECRET_ACCESS_KEY, GLUE_CATALOG_PROP_URI,
32+
GLUE_CATALOG_PROP_WAREHOUSE, GlueCatalog, GlueCatalogBuilder,
3033
};
3134
use iceberg_test_utils::docker::DockerCompose;
3235
use iceberg_test_utils::{normalize_test_name, set_up};
@@ -112,13 +115,22 @@ async fn get_catalog() -> GlueCatalog {
112115
retries += 1;
113116
}
114117

115-
let config = GlueCatalogConfig::builder()
116-
.uri(format!("http://{}", glue_socket_addr))
117-
.warehouse("s3a://warehouse/hive".to_string())
118-
.props(props.clone())
119-
.build();
118+
let mut glue_props = HashMap::from([
119+
(
120+
GLUE_CATALOG_PROP_URI.to_string(),
121+
format!("http://{}", glue_socket_addr),
122+
),
123+
(
124+
GLUE_CATALOG_PROP_WAREHOUSE.to_string(),
125+
"s3a://warehouse/hive".to_string(),
126+
),
127+
]);
128+
glue_props.extend(props.clone());
120129

121-
GlueCatalog::new(config).await.unwrap()
130+
GlueCatalogBuilder::default()
131+
.load("glue", glue_props)
132+
.await
133+
.unwrap()
122134
}
123135

124136
async fn set_test_namespace(catalog: &GlueCatalog, namespace: &NamespaceIdent) -> Result<()> {

0 commit comments

Comments
 (0)