This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git


The following commit(s) were added to refs/heads/main by this push:
     new 9ae9e13  Replace unwrap (#183)
9ae9e13 is described below

commit 9ae9e13fb48ea8af20d76644f27dcb2fc8773396
Author: Chengxu Bian <[email protected]>
AuthorDate: Fri Feb 2 05:00:19 2024 -0500

    Replace unwrap (#183)
---
 crates/iceberg/src/spec/manifest.rs       |  2 +-
 crates/iceberg/src/spec/manifest_list.rs  |  4 ++--
 crates/iceberg/src/spec/table_metadata.rs | 16 ++++++++--------
 crates/iceberg/src/transaction.rs         |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/crates/iceberg/src/spec/manifest.rs 
b/crates/iceberg/src/spec/manifest.rs
index d943a55..1822468 100644
--- a/crates/iceberg/src/spec/manifest.rs
+++ b/crates/iceberg/src/spec/manifest.rs
@@ -661,7 +661,7 @@ mod _const_schema {
                 ])),
             )),
         ];
-        let schema = Schema::builder().with_fields(fields).build().unwrap();
+        let schema = Schema::builder().with_fields(fields).build()?;
         schema_to_avro_schema("manifest", &schema)
     }
 
diff --git a/crates/iceberg/src/spec/manifest_list.rs 
b/crates/iceberg/src/spec/manifest_list.rs
index a3bf0c4..440b8d8 100644
--- a/crates/iceberg/src/spec/manifest_list.rs
+++ b/crates/iceberg/src/spec/manifest_list.rs
@@ -215,8 +215,8 @@ impl ManifestListWriter {
     pub async fn close(self) -> Result<()> {
         let data = self.avro_writer.into_inner()?;
         let mut writer = self.output_file.writer().await?;
-        writer.write_all(&data).await.unwrap();
-        writer.close().await.unwrap();
+        writer.write_all(&data).await?;
+        writer.close().await?;
         Ok(())
     }
 }
diff --git a/crates/iceberg/src/spec/table_metadata.rs 
b/crates/iceberg/src/spec/table_metadata.rs
index c7f5111..6343ace 100644
--- a/crates/iceberg/src/spec/table_metadata.rs
+++ b/crates/iceberg/src/spec/table_metadata.rs
@@ -687,7 +687,7 @@ pub(super) mod _serde {
                 schema: v
                     .schemas
                     .get(&v.current_schema_id)
-                    .unwrap()
+                    .expect("current_schema_id not found in schemas")
                     .as_ref()
                     .clone()
                     .into(),
@@ -867,12 +867,12 @@ mod tests {
                     {
                         "spec-id": 1,
                         "fields": [
-                            {  
-                                "source-id": 4,  
-                                "field-id": 1000,  
-                                "name": "ts_day",  
+                            {
+                                "source-id": 4,
+                                "field-id": 1000,
+                                "name": "ts_day",
                                 "transform": "day"
-                            } 
+                            }
                         ]
                     }
                 ],
@@ -882,8 +882,8 @@ mod tests {
                     "commit.retry.num-retries": "1"
                 },
                 "metadata-log": [
-                    {  
-                        "metadata-file": "s3://bucket/.../v1.json",  
+                    {
+                        "metadata-file": "s3://bucket/.../v1.json",
                         "timestamp-ms": 1515100
                     }
                 ],
diff --git a/crates/iceberg/src/transaction.rs 
b/crates/iceberg/src/transaction.rs
index 4ea89a2..5de0ea6 100644
--- a/crates/iceberg/src/transaction.rs
+++ b/crates/iceberg/src/transaction.rs
@@ -160,7 +160,7 @@ impl<'a> ReplaceSortOrderAction<'a> {
                     .table
                     .metadata()
                     .default_sort_order()
-                    .unwrap()
+                    .expect("default sort order impossible to be None")
                     .order_id,
             },
         ];

Reply via email to