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


##########
parquet-variant-json/src/to_json.rs:
##########
@@ -457,6 +472,20 @@ mod tests {
         Ok(())
     }
 
+    #[test]
+    fn test_time_to_json() -> Result<(), ArrowError> {
+        let naive_time = NaiveTime::from_num_seconds_from_midnight_opt(12345, 
123460708).unwrap();
+        let variant = Variant::Time(naive_time);
+        let json = variant_to_json_string(&variant)?;
+        assert!(json.contains("03:25:45.12346"));
+        assert!(json.starts_with('"') && json.ends_with('"'));
+
+        let json_value = variant_to_json_value(&variant)?;
+        assert!(matches!(json_value, Value::String(_)));
+        println!("{:?}", json);

Review Comment:
   fixed



##########
parquet-variant-json/src/to_json.rs:
##########
@@ -457,6 +472,20 @@ mod tests {
         Ok(())
     }
 
+    #[test]
+    fn test_time_to_json() -> Result<(), ArrowError> {
+        let naive_time = NaiveTime::from_num_seconds_from_midnight_opt(12345, 
123460708).unwrap();
+        let variant = Variant::Time(naive_time);
+        let json = variant_to_json_string(&variant)?;
+        assert!(json.contains("03:25:45.12346"));

Review Comment:
   Fixed it. referenced to some other tests before



##########
parquet-variant/src/variant.rs:
##########
@@ -248,6 +248,8 @@ pub enum Variant<'m, 'v> {
     Binary(&'v [u8]),
     /// Primitive (type_id=1): STRING
     String(&'v str),
+    /// Primitive (type_id=1): TIME(isAdjustedToUTC=false, MICROS)
+    Time(NaiveTime),

Review Comment:
   IIUC, we can use `NaiveTime` here, I can change it if we have a preference 
here. 
   
   The [Variant 
spec](https://github.com/apache/parquet-format/blob/37b6e8b863fb510314c07649665251f6474b0c11/VariantEncoding.md#encoding-types)
 says that `TimeNTZ` is for `time without time zone`, and `NaiveTime` is for 
that, as [the 
doc](https://docs.rs/chrono/latest/chrono/naive/struct.NaiveTime.html) said 
`ISO 8601 time without timezone.`.
   The docs of [Utc](https://docs.rs/chrono/latest/chrono/struct.Utc.html) said 
that is for `The UTC time zone.`, It seems that it will attach the `time zone` 
information.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to