klion26 commented on code in PR #8149:
URL: https://github.com/apache/arrow-rs/pull/8149#discussion_r2283974908


##########
parquet-variant/src/variant.rs:
##########
@@ -632,6 +642,31 @@ impl<'m, 'v> Variant<'m, 'v> {
         }
     }
 
+    /// Converts this variant to a `uuid hyphenated string` if possible.
+    ///
+    /// Returns `Some(String)` for UUID variants, `None` for non-UUID variants.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use parquet_variant::Variant;
+    ///
+    /// // you can extract a UUID string from a UUID variant
+    /// let s = 
uuid::Uuid::parse_str("67e55044-10b1-426f-9247-bb680e5fe0c8").unwrap();
+    /// let v1 = Variant::Uuid(s);
+    /// assert_eq!("67e55044-10b1-426f-9247-bb680e5fe0c8", 
v1.as_uuid_string().unwrap());
+    ///
+    /// //but not from other variants
+    /// let v2 = Variant::from(1234);
+    /// assert_eq!(None, v2.as_uuid_string())
+    /// ```
+    pub fn as_uuid_string(&self) -> Option<String> {

Review Comment:
   fixed



##########
parquet-variant/src/decoder.rs:
##########
@@ -316,6 +323,33 @@ pub(crate) fn decode_time_ntz(data: &[u8]) -> 
Result<NaiveTime, ArrowError> {
     .ok_or(case_error)
 }
 
+/// Decodes a TimestampNanos from the value section of a variant.
+pub(crate) fn decode_timestamp_nanos(data: &[u8]) -> Result<DateTime<Utc>, 
ArrowError> {
+    let nanos_since_epoch = i64::from_le_bytes(array_from_slice(data, 0)?);
+
+    // Copied from DateTime::from_timestamp_nanos as there is no infallible 
version

Review Comment:
   Changed the implementation. When I implemented this, I did not notice that 
the `DateTime::from_timestamp_nanos` would never fail, added the comment to 
show why we use `DateTime::from_timestamp` instead of 
`DateTime::from_timestamp_nanos`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to