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 a4c43c9  chore: Ping toolchain version (#48)
a4c43c9 is described below

commit a4c43c901754391cb7a0da6ff6c8d6bc517c2f03
Author: Renjie Liu <[email protected]>
AuthorDate: Wed Aug 30 15:59:42 2023 +0800

    chore: Ping toolchain version (#48)
    
    * chore: Ping toolchain version
    
    * Fix ci
    
    * Format
---
 Cargo.toml                                |  1 +
 Cargo.toml => Makefile                    | 13 +++++++++++--
 crates/iceberg/src/spec/datatypes.rs      | 10 +++++-----
 crates/iceberg/src/spec/schema.rs         |  8 ++++----
 crates/iceberg/src/spec/table_metadata.rs |  3 +--
 crates/iceberg/src/spec/values.rs         | 15 ++++++---------
 rust-toolchain.toml                       |  2 +-
 7 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 9e3e2e8..34eef8d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,4 +16,5 @@
 # under the License.
 
 [workspace]
+resolver = "2"
 members = ["crates/*"]
diff --git a/Cargo.toml b/Makefile
similarity index 73%
copy from Cargo.toml
copy to Makefile
index 9e3e2e8..ee0bbd7 100644
--- a/Cargo.toml
+++ b/Makefile
@@ -15,5 +15,14 @@
 # specific language governing permissions and limitations
 # under the License.
 
-[workspace]
-members = ["crates/*"]
+check-fmt:
+       cargo fmt --all -- --check
+
+clippy:
+       cargo clippy --all-targets --all-features --workspace -- -D warnings
+
+check: check-fmt clippy
+
+test:
+       cargo test --no-fail-fast --all-targets --all-features --workspace
+       cargo test --no-fail-fast --doc --all-features --workspace
\ No newline at end of file
diff --git a/crates/iceberg/src/spec/datatypes.rs 
b/crates/iceberg/src/spec/datatypes.rs
index 9d51105..eef24e1 100644
--- a/crates/iceberg/src/spec/datatypes.rs
+++ b/crates/iceberg/src/spec/datatypes.rs
@@ -22,9 +22,9 @@ use ::serde::de::{MapAccess, Visitor};
 use serde::de::{Error, IntoDeserializer};
 use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
 use serde_json::Value as JsonValue;
-use std::cell::OnceCell;
 use std::convert::identity;
 use std::sync::Arc;
+use std::sync::OnceLock;
 use std::{collections::HashMap, fmt, ops::Index};
 
 use super::values::Literal;
@@ -239,7 +239,7 @@ pub struct StructType {
     fields: Vec<NestedFieldRef>,
     /// Lookup for index by field id
     #[serde(skip_serializing)]
-    id_lookup: OnceCell<HashMap<i32, usize>>,
+    id_lookup: OnceLock<HashMap<i32, usize>>,
 }
 
 impl<'de> Deserialize<'de> for StructType {
@@ -296,7 +296,7 @@ impl StructType {
     pub fn new(fields: Vec<NestedFieldRef>) -> Self {
         Self {
             fields,
-            id_lookup: OnceCell::default(),
+            id_lookup: OnceLock::new(),
         }
     }
     /// Get struct field with certain id
@@ -678,7 +678,7 @@ mod tests {
                     }),
                 )
                 .into()],
-                id_lookup: OnceCell::default(),
+                id_lookup: OnceLock::default(),
             }),
         )
     }
@@ -708,7 +708,7 @@ mod tests {
                     Type::Primitive(PrimitiveType::Fixed(8)),
                 )
                 .into()],
-                id_lookup: OnceCell::default(),
+                id_lookup: OnceLock::default(),
             }),
         )
     }
diff --git a/crates/iceberg/src/spec/schema.rs 
b/crates/iceberg/src/spec/schema.rs
index 654a10e..865df25 100644
--- a/crates/iceberg/src/spec/schema.rs
+++ b/crates/iceberg/src/spec/schema.rs
@@ -25,9 +25,9 @@ use crate::spec::datatypes::{
 use crate::{ensure_data_valid, Error, ErrorKind};
 use bimap::BiHashMap;
 use itertools::Itertools;
-use once_cell::sync::OnceCell;
 use std::collections::{HashMap, HashSet};
 use std::fmt::{Display, Formatter};
+use std::sync::OnceLock;
 
 const DEFAULT_SCHEMA_ID: i32 = 0;
 
@@ -44,7 +44,7 @@ pub struct Schema {
 
     name_to_id: HashMap<String, i32>,
     id_to_name: HashMap<i32, String>,
-    lower_case_name_to_id: OnceCell<HashMap<String, i32>>,
+    lower_case_name_to_id: OnceLock<HashMap<String, i32>>,
 }
 
 /// Schema builder.
@@ -58,7 +58,7 @@ pub struct SchemaBuilder {
 impl SchemaBuilder {
     /// Add fields to schem builder.
     pub fn with_fields(mut self, fields: impl IntoIterator<Item = 
NestedFieldRef>) -> Self {
-        self.fields.extend(fields.into_iter());
+        self.fields.extend(fields);
         self
     }
 
@@ -110,7 +110,7 @@ impl SchemaBuilder {
 
             name_to_id,
             id_to_name,
-            lower_case_name_to_id: OnceCell::default(),
+            lower_case_name_to_id: OnceLock::default(),
         })
     }
 
diff --git a/crates/iceberg/src/spec/table_metadata.rs 
b/crates/iceberg/src/spec/table_metadata.rs
index 40fe11a..ebf7cca 100644
--- a/crates/iceberg/src/spec/table_metadata.rs
+++ b/crates/iceberg/src/spec/table_metadata.rs
@@ -358,8 +358,7 @@ pub(super) mod _serde {
                         .schemas
                         .into_iter()
                         .map(|schema| Ok((schema.schema_id, 
Arc::new(schema.try_into()?))))
-                        .collect::<Result<Vec<_>, Error>>()?
-                        .into_iter(),
+                        .collect::<Result<Vec<_>, Error>>()?,
                 ),
                 current_schema_id: value.current_schema_id,
                 partition_specs: HashMap::from_iter(
diff --git a/crates/iceberg/src/spec/values.rs 
b/crates/iceberg/src/spec/values.rs
index 63106c6..fd1b2b5 100644
--- a/crates/iceberg/src/spec/values.rs
+++ b/crates/iceberg/src/spec/values.rs
@@ -733,9 +733,8 @@ impl Literal {
                 ))),
                 (PrimitiveType::Timestamptz, JsonValue::String(s)) => {
                     Ok(Some(Literal::Primitive(PrimitiveLiteral::TimestampTZ(
-                        
timestamptz::datetimetz_to_microseconds(&DateTime::from_utc(
-                            NaiveDateTime::parse_from_str(&s, 
"%Y-%m-%dT%H:%M:%S%.f+00:00")?,
-                            Utc,
+                        
timestamptz::datetimetz_to_microseconds(&Utc.from_utc_datetime(
+                            &NaiveDateTime::parse_from_str(&s, 
"%Y-%m-%dT%H:%M:%S%.f+00:00")?,
                         )),
                     ))))
                 }
@@ -827,8 +826,7 @@ impl Literal {
                                         Literal::try_from_json(value, 
&map.value_field.field_type)?,
                                     ))
                                 })
-                                .collect::<Result<Vec<_>>>()?
-                                .into_iter(),
+                                .collect::<Result<Vec<_>>>()?,
                         ))))
                     } else {
                         Err(Error::new(
@@ -952,7 +950,7 @@ mod timestamp {
 }
 
 mod timestamptz {
-    use chrono::{DateTime, NaiveDateTime, Utc};
+    use chrono::{DateTime, NaiveDateTime, TimeZone, Utc};
 
     pub(crate) fn datetimetz_to_microseconds(time: &DateTime<Utc>) -> i64 {
         time.timestamp_micros()
@@ -961,10 +959,9 @@ mod timestamptz {
     pub(crate) fn microseconds_to_datetimetz(micros: i64) -> DateTime<Utc> {
         let (secs, rem) = (micros / 1_000_000, micros % 1_000_000);
 
-        DateTime::<Utc>::from_utc(
+        Utc.from_utc_datetime(
             // This shouldn't fail until the year 262000
-            NaiveDateTime::from_timestamp_opt(secs, rem as u32 * 
1_000).unwrap(),
-            Utc,
+            &NaiveDateTime::from_timestamp_opt(secs, rem as u32 * 
1_000).unwrap(),
         )
     }
 }
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index 870d7eb..4d50218 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -16,5 +16,5 @@
 # under the License.
 
 [toolchain]
-channel = "stable"
+channel = "1.72.0"
 components = ["rustfmt", "clippy"]

Reply via email to