Skip to content

Commit 3ffd73b

Browse files
committed
address format
1 parent e680774 commit 3ffd73b

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

crates/catalog/hms/src/catalog.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,9 @@ impl Catalog for HmsCatalog {
753753
let metadata_location = get_metadata_location(&hive_table.parameters)?;
754754
let env_context = Self::build_environment_context(&metadata_location);
755755

756-
let (staged_table, new_hive_table) =
757-
self.apply_and_prepare_update(commit, &db_name, &tbl_name, &hive_table)
758-
.await?;
756+
let (staged_table, new_hive_table) = self
757+
.apply_and_prepare_update(commit, &db_name, &tbl_name, &hive_table)
758+
.await?;
759759

760760
self.client
761761
.0
@@ -781,9 +781,9 @@ impl Catalog for HmsCatalog {
781781
.map(from_thrift_exception)
782782
.map_err(from_thrift_error)??;
783783

784-
let (staged_table, new_hive_table) =
785-
self.apply_and_prepare_update(commit, &db_name, &tbl_name, &hive_table)
786-
.await?;
784+
let (staged_table, new_hive_table) = self
785+
.apply_and_prepare_update(commit, &db_name, &tbl_name, &hive_table)
786+
.await?;
787787

788788
self.client
789789
.0

crates/catalog/hms/src/utils.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,15 @@ pub(crate) fn update_hive_table_from_table(
181181

182182
let metadata_location = tbl.metadata_location_result()?.to_string();
183183

184-
let mut params: AHashMap<FastStr, FastStr> =
185-
new_tbl.parameters.take().unwrap_or_default();
184+
let mut params: AHashMap<FastStr, FastStr> = new_tbl.parameters.take().unwrap_or_default();
186185
for (k, v) in metadata.properties().iter() {
187186
if k == METADATA_LOCATION || k == TABLE_TYPE || k == EXTERNAL {
188187
continue;
189188
}
190-
params.insert(FastStr::from_string(k.to_string()), FastStr::from_string(v.to_string()));
189+
params.insert(
190+
FastStr::from_string(k.to_string()),
191+
FastStr::from_string(v.to_string()),
192+
);
191193
}
192194

193195
params.insert(FastStr::from(EXTERNAL), FastStr::from("TRUE"));
@@ -356,10 +358,7 @@ fn get_current_time() -> Result<i32> {
356358
})
357359
}
358360

359-
pub(crate) fn create_lock_request(
360-
db_name: &str,
361-
tbl_name: &str,
362-
) -> hive_metastore::LockRequest {
361+
pub(crate) fn create_lock_request(db_name: &str, tbl_name: &str) -> hive_metastore::LockRequest {
363362
let component = hive_metastore::LockComponent {
364363
r#type: hive_metastore::LockType::EXCLUSIVE,
365364
level: hive_metastore::LockLevel::TABLE,

crates/catalog/hms/tests/hms_catalog_test.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ 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::transaction::{ApplyTransactionAction, Transaction};
2728
use iceberg::{Catalog, CatalogBuilder, Namespace, NamespaceIdent, TableCreation, TableIdent};
2829
use iceberg_catalog_hms::{
2930
HMS_CATALOG_PROP_THRIFT_TRANSPORT, HMS_CATALOG_PROP_URI, HMS_CATALOG_PROP_WAREHOUSE,
@@ -34,7 +35,6 @@ use iceberg_test_utils::{normalize_test_name, set_up};
3435
use port_scanner::scan_port_addr;
3536
use tokio::time::sleep;
3637
use tracing::info;
37-
use iceberg::transaction::{Transaction, ApplyTransactionAction};
3838

3939
const HMS_CATALOG_PORT: u16 = 9083;
4040
const MINIO_PORT: u16 = 9000;
@@ -497,13 +497,19 @@ async fn test_update_table_with_optimistic_locking() -> Result<()> {
497497
let tx = Transaction::new(&table);
498498
let tx = tx
499499
.update_table_properties()
500-
.set("test_property_optimistic".to_string(), "test_value_optimistic".to_string())
500+
.set(
501+
"test_property_optimistic".to_string(),
502+
"test_value_optimistic".to_string(),
503+
)
501504
.apply(tx)?;
502505

503506
let updated_table = tx.commit(&catalog).await?;
504507

505508
assert_eq!(
506-
updated_table.metadata().properties().get("test_property_optimistic"),
509+
updated_table
510+
.metadata()
511+
.properties()
512+
.get("test_property_optimistic"),
507513
Some(&"test_value_optimistic".to_string())
508514
);
509515

@@ -515,7 +521,10 @@ async fn test_update_table_with_optimistic_locking() -> Result<()> {
515521

516522
let reloaded_table = catalog.load_table(table.identifier()).await?;
517523
assert_eq!(
518-
reloaded_table.metadata().properties().get("test_property_optimistic"),
524+
reloaded_table
525+
.metadata()
526+
.properties()
527+
.get("test_property_optimistic"),
519528
Some(&"test_value_optimistic".to_string())
520529
);
521530
assert_eq!(

0 commit comments

Comments
 (0)