Skip to content
Merged
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
24 changes: 9 additions & 15 deletions crates/catalog/glue/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ impl Catalog for GlueCatalog {
}
None => Err(Error::new(
ErrorKind::DataInvalid,
format!("Database with name: {} does not exist", db_name),
format!("Database with name: {db_name} does not exist"),
)),
}
}
Expand Down Expand Up @@ -531,8 +531,7 @@ impl Catalog for GlueCatalog {
None => Err(Error::new(
ErrorKind::TableNotFound,
format!(
"Table object for database: {} and table: {} does not exist",
db_name, table_name
"Table object for database: {db_name} and table: {table_name} does not exist"
),
)),
Some(table) => {
Expand Down Expand Up @@ -643,8 +642,7 @@ impl Catalog for GlueCatalog {
None => Err(Error::new(
ErrorKind::TableNotFound,
format!(
"'Table' object for database: {} and table: {} does not exist",
src_db_name, src_table_name
"'Table' object for database: {src_db_name} and table: {src_table_name} does not exist"
),
)),
Some(table) => {
Expand Down Expand Up @@ -672,26 +670,22 @@ impl Catalog for GlueCatalog {
match drop_src_table_result {
Ok(_) => Ok(()),
Err(_) => {
let err_msg_src_table = format!(
"Failed to drop old table {}.{}.",
src_db_name, src_table_name
);
let err_msg_src_table =
format!("Failed to drop old table {src_db_name}.{src_table_name}.");

let drop_dest_table_result = self.drop_table(dest).await;

match drop_dest_table_result {
Ok(_) => Err(Error::new(
ErrorKind::Unexpected,
format!(
"{} Rolled back table creation for {}.{}.",
err_msg_src_table, dest_db_name, dest_table_name
"{err_msg_src_table} Rolled back table creation for {dest_db_name}.{dest_table_name}."
),
)),
Err(_) => Err(Error::new(
ErrorKind::Unexpected,
format!(
"{} Failed to roll back table creation for {}.{}. Please clean up manually.",
err_msg_src_table, dest_db_name, dest_table_name
"{err_msg_src_table} Failed to roll back table creation for {dest_db_name}.{dest_table_name}. Please clean up manually."
),
)),
}
Expand Down Expand Up @@ -753,7 +747,7 @@ impl Catalog for GlueCatalog {
format!("Failed to register table {table_ident} due to AWS SDK error"),
),
}
.with_source(anyhow!("aws sdk error: {:?}", error))
.with_source(anyhow!("aws sdk error: {error:?}"))
})?;

Ok(Table::builder()
Expand Down Expand Up @@ -811,7 +805,7 @@ impl Catalog for GlueCatalog {
format!("Operation failed for table: {table_ident} for hitting aws sdk error"),
),
}
.with_source(anyhow!("aws sdk error: {:?}", error))
.with_source(anyhow!("aws sdk error: {error:?}"))
})?;

Ok(staged_table)
Expand Down
4 changes: 2 additions & 2 deletions crates/catalog/glue/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ where T: Debug {
ErrorKind::Unexpected,
"Operation failed for hitting aws sdk error".to_string(),
)
.with_source(anyhow!("aws sdk error: {:?}", error))
.with_source(anyhow!("aws sdk error: {error:?}"))
}

/// Format AWS Build error into iceberg error
Expand All @@ -36,5 +36,5 @@ pub(crate) fn from_aws_build_error(error: aws_sdk_glue::error::BuildError) -> Er
ErrorKind::Unexpected,
"Operation failed for hitting aws build error".to_string(),
)
.with_source(anyhow!("aws build error: {:?}", error))
.with_source(anyhow!("aws build error: {error:?}"))
}
6 changes: 3 additions & 3 deletions crates/catalog/glue/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl SchemaVisitor for GlueSchemaBuilder {
}

fn list(&mut self, _list: &iceberg::spec::ListType, value: String) -> iceberg::Result<String> {
Ok(format!("array<{}>", value))
Ok(format!("array<{value}>"))
}

fn map(
Expand All @@ -152,7 +152,7 @@ impl SchemaVisitor for GlueSchemaBuilder {
key_value: String,
value: String,
) -> iceberg::Result<String> {
Ok(format!("map<{},{}>", key_value, value))
Ok(format!("map<{key_value},{value}>"))
}

fn primitive(&mut self, p: &iceberg::spec::PrimitiveType) -> iceberg::Result<Self::T> {
Expand All @@ -171,7 +171,7 @@ impl SchemaVisitor for GlueSchemaBuilder {
}
PrimitiveType::Binary | PrimitiveType::Fixed(_) => "binary".to_string(),
PrimitiveType::Decimal { precision, scale } => {
format!("decimal({},{})", precision, scale)
format!("decimal({precision},{scale})")
}
_ => {
return Err(Error::new(
Expand Down
5 changes: 2 additions & 3 deletions crates/catalog/glue/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ pub(crate) fn validate_namespace(namespace: &NamespaceIdent) -> Result<String> {
return Err(Error::new(
ErrorKind::DataInvalid,
format!(
"Invalid database name: {:?}, hierarchical namespaces are not supported",
namespace
"Invalid database name: {namespace:?}, hierarchical namespaces are not supported"
),
));
}
Expand Down Expand Up @@ -236,7 +235,7 @@ pub(crate) fn get_metadata_location(
Some(location) => Ok(location.to_string()),
None => Err(Error::new(
ErrorKind::DataInvalid,
format!("No '{}' set on table", METADATA_LOCATION),
format!("No '{METADATA_LOCATION}' set on table"),
)),
},
None => Err(Error::new(
Expand Down
4 changes: 2 additions & 2 deletions crates/catalog/glue/tests/glue_catalog_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async fn get_catalog() -> GlueCatalog {
(AWS_REGION_NAME.to_string(), "us-east-1".to_string()),
(
S3_ENDPOINT.to_string(),
format!("http://{}", minio_socket_addr),
format!("http://{minio_socket_addr}"),
),
(S3_ACCESS_KEY_ID.to_string(), "admin".to_string()),
(S3_SECRET_ACCESS_KEY.to_string(), "password".to_string()),
Expand Down Expand Up @@ -119,7 +119,7 @@ async fn get_catalog() -> GlueCatalog {
let mut glue_props = HashMap::from([
(
GLUE_CATALOG_PROP_URI.to_string(),
format!("http://{}", glue_socket_addr),
format!("http://{glue_socket_addr}"),
),
(
GLUE_CATALOG_PROP_WAREHOUSE.to_string(),
Expand Down
4 changes: 2 additions & 2 deletions crates/catalog/hms/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ impl Catalog for HmsCatalog {
ErrorKind::Unexpected,
"Operation failed for hitting thrift error".to_string(),
)
.with_source(anyhow!("thrift error: {:?}", exception))),
.with_source(anyhow!("thrift error: {exception:?}"))),
Err(err) => Err(from_thrift_error(err)),
}
}
Expand Down Expand Up @@ -554,7 +554,7 @@ impl Catalog for HmsCatalog {
ErrorKind::Unexpected,
"Operation failed for hitting thrift error".to_string(),
)
.with_source(anyhow!("thrift error: {:?}", exception))),
.with_source(anyhow!("thrift error: {exception:?}"))),
Err(err) => Err(from_thrift_error(err)),
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/catalog/hms/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn from_thrift_error(error: impl std::error::Error) -> Error {
ErrorKind::Unexpected,
"Operation failed for hitting thrift error".to_string(),
)
.with_source(anyhow!("thrift error: {:?}", error))
.with_source(anyhow!("thrift error: {error:?}"))
}

/// Format a thrift exception into iceberg error.
Expand All @@ -41,7 +41,7 @@ pub fn from_thrift_exception<T, E: Debug>(value: MaybeException<T, E>) -> Result
ErrorKind::Unexpected,
"Operation failed for hitting thrift error".to_string(),
)
.with_source(anyhow!("thrift error: {:?}", err))),
.with_source(anyhow!("thrift error: {err:?}"))),
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/catalog/hms/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl SchemaVisitor for HiveSchemaBuilder {
}

fn list(&mut self, _list: &iceberg::spec::ListType, value: String) -> iceberg::Result<String> {
Ok(format!("array<{}>", value))
Ok(format!("array<{value}>"))
}

fn map(
Expand All @@ -109,7 +109,7 @@ impl SchemaVisitor for HiveSchemaBuilder {
key_value: String,
value: String,
) -> iceberg::Result<String> {
Ok(format!("map<{},{}>", key_value, value))
Ok(format!("map<{key_value},{value}>"))
}

fn primitive(&mut self, p: &iceberg::spec::PrimitiveType) -> iceberg::Result<String> {
Expand All @@ -128,7 +128,7 @@ impl SchemaVisitor for HiveSchemaBuilder {
}
PrimitiveType::Binary | PrimitiveType::Fixed(_) => "binary".to_string(),
PrimitiveType::Decimal { precision, scale } => {
format!("decimal({},{})", precision, scale)
format!("decimal({precision},{scale})")
}
_ => {
return Err(Error::new(
Expand Down
12 changes: 5 additions & 7 deletions crates/catalog/hms/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub(crate) fn convert_to_database(
_ => {
return Err(Error::new(
ErrorKind::DataInvalid,
format!("Invalid value for setting 'owner_type': {}", v),
format!("Invalid value for setting 'owner_type': {v}"),
));
}
};
Expand Down Expand Up @@ -214,8 +214,7 @@ pub(crate) fn validate_namespace(namespace: &NamespaceIdent) -> Result<String> {
return Err(Error::new(
ErrorKind::DataInvalid,
format!(
"Invalid database name: {:?}, hierarchical namespaces are not supported",
namespace
"Invalid database name: {namespace:?}, hierarchical namespaces are not supported"
),
));
}
Expand Down Expand Up @@ -257,7 +256,7 @@ pub(crate) fn get_metadata_location(
Some(location) => Ok(location.to_string()),
None => Err(Error::new(
ErrorKind::DataInvalid,
format!("No '{}' set on table", METADATA_LOCATION),
format!("No '{METADATA_LOCATION}' set on table"),
)),
},
None => Err(Error::new(
Expand All @@ -272,7 +271,7 @@ fn format_location_uri(location: String) -> String {
let mut location = location;

if !location.starts_with('/') {
location = format!("/{}", location);
location = format!("/{location}");
}

if location.ends_with('/') && location.len() > 1 {
Expand All @@ -292,8 +291,7 @@ fn validate_owner_settings(properties: &HashMap<String, String>) -> Result<()> {
return Err(Error::new(
ErrorKind::DataInvalid,
format!(
"Setting '{}' without setting '{}' is not allowed",
HMS_DB_OWNER_TYPE, HMS_DB_OWNER
"Setting '{HMS_DB_OWNER_TYPE}' without setting '{HMS_DB_OWNER}' is not allowed"
),
));
}
Expand Down
2 changes: 1 addition & 1 deletion crates/catalog/hms/tests/hms_catalog_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async fn get_catalog() -> HmsCatalog {
),
(
S3_ENDPOINT.to_string(),
format!("http://{}", minio_socket_addr),
format!("http://{minio_socket_addr}"),
),
(S3_ACCESS_KEY_ID.to_string(), "admin".to_string()),
(S3_SECRET_ACCESS_KEY.to_string(), "password".to_string()),
Expand Down
6 changes: 3 additions & 3 deletions crates/catalog/rest/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl RestCatalogConfig {
),
(
header::USER_AGENT,
HeaderValue::from_str(&format!("iceberg-rs/{}", CARGO_PKG_VERSION)).unwrap(),
HeaderValue::from_str(&format!("iceberg-rs/{CARGO_PKG_VERSION}")).unwrap(),
),
]);

Expand Down Expand Up @@ -1273,7 +1273,7 @@ mod tests {
),
(
header::USER_AGENT,
HeaderValue::from_str(&format!("iceberg-rs/{}", CARGO_PKG_VERSION)).unwrap(),
HeaderValue::from_str(&format!("iceberg-rs/{CARGO_PKG_VERSION}")).unwrap(),
),
]);
assert_eq!(headers, expected_headers);
Expand Down Expand Up @@ -1310,7 +1310,7 @@ mod tests {
),
(
header::USER_AGENT,
HeaderValue::from_str(&format!("iceberg-rs/{}", CARGO_PKG_VERSION)).unwrap(),
HeaderValue::from_str(&format!("iceberg-rs/{CARGO_PKG_VERSION}")).unwrap(),
),
(
HeaderName::from_static("customized-header"),
Expand Down
2 changes: 1 addition & 1 deletion crates/catalog/rest/tests/rest_catalog_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async fn get_catalog() -> RestCatalog {
"rest",
HashMap::from([(
REST_CATALOG_PROP_URI.to_string(),
format!("http://{}", rest_socket_addr),
format!("http://{rest_socket_addr}"),
)]),
)
.await
Expand Down
18 changes: 9 additions & 9 deletions crates/catalog/s3tables/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ impl Catalog for S3TablesCatalog {
"Operation failed for hitting aws sdk error",
),
}
.with_source(anyhow::Error::msg(format!("aws sdk error: {:?}", error)))
.with_source(anyhow::Error::msg(format!("aws sdk error: {error:?}")))
})?;

Ok(staged_table)
Expand All @@ -649,7 +649,7 @@ pub(crate) fn from_aws_sdk_error<T>(error: aws_sdk_s3tables::error::SdkError<T>)
where T: std::fmt::Debug {
Error::new(
ErrorKind::Unexpected,
format!("Operation failed for hitting aws sdk error: {:?}", error),
format!("Operation failed for hitting aws sdk error: {error:?}"),
)
}

Expand Down Expand Up @@ -682,7 +682,7 @@ mod tests {
let catalog = match load_s3tables_catalog_from_env().await {
Ok(Some(catalog)) => catalog,
Ok(None) => return,
Err(e) => panic!("Error loading catalog: {}", e),
Err(e) => panic!("Error loading catalog: {e}"),
};

let namespaces = catalog.list_namespaces(None).await.unwrap();
Expand All @@ -694,7 +694,7 @@ mod tests {
let catalog = match load_s3tables_catalog_from_env().await {
Ok(Some(catalog)) => catalog,
Ok(None) => return,
Err(e) => panic!("Error loading catalog: {}", e),
Err(e) => panic!("Error loading catalog: {e}"),
};

let tables = catalog
Expand All @@ -709,7 +709,7 @@ mod tests {
let catalog = match load_s3tables_catalog_from_env().await {
Ok(Some(catalog)) => catalog,
Ok(None) => return,
Err(e) => panic!("Error loading catalog: {}", e),
Err(e) => panic!("Error loading catalog: {e}"),
};

let table = catalog
Expand All @@ -719,15 +719,15 @@ mod tests {
))
.await
.unwrap();
println!("{:?}", table);
println!("{table:?}");
}

#[tokio::test]
async fn test_s3tables_create_delete_namespace() {
let catalog = match load_s3tables_catalog_from_env().await {
Ok(Some(catalog)) => catalog,
Ok(None) => return,
Err(e) => panic!("Error loading catalog: {}", e),
Err(e) => panic!("Error loading catalog: {e}"),
};

let namespace = NamespaceIdent::new("test_s3tables_create_delete_namespace".to_string());
Expand All @@ -745,7 +745,7 @@ mod tests {
let catalog = match load_s3tables_catalog_from_env().await {
Ok(Some(catalog)) => catalog,
Ok(None) => return,
Err(e) => panic!("Error loading catalog: {}", e),
Err(e) => panic!("Error loading catalog: {e}"),
};

let creation = {
Expand Down Expand Up @@ -788,7 +788,7 @@ mod tests {
let catalog = match load_s3tables_catalog_from_env().await {
Ok(Some(catalog)) => catalog,
Ok(None) => return,
Err(e) => panic!("Error loading catalog: {}", e),
Err(e) => panic!("Error loading catalog: {e}"),
};

// Create a test namespace and table
Expand Down
Loading
Loading