alamb commented on code in PR #8950:
URL: https://github.com/apache/arrow-rs/pull/8950#discussion_r2608244619


##########
parquet-variant-compute/src/variant_get.rs:
##########
@@ -1054,6 +1184,47 @@ mod test {
         Time64MicrosecondArray::from(vec![Some(12345000), Some(87654000), 
Some(135792000)])
     );
 
+    perfectly_shredded_to_arrow_primitive_test!(
+        get_variant_perfectly_shredded_time_as_time64_nano,
+        DataType::Time64(TimeUnit::Nanosecond),
+        perfectly_shredded_time_variant_array,
+        Time64NanosecondArray::from(vec![
+            Some(12345000000),
+            Some(87654000000),
+            Some(135792000000)
+        ])
+    );
+
+    
perfectly_shredded_variant_array_fn!(perfectly_shredded_time_variant_array_for_time32,
 || {
+        Time64MicrosecondArray::from(vec![
+            Some(1234),        // This can't be cast to Time32

Review Comment:
   it can cast,  but the cast is not lossless



##########
parquet-variant-compute/src/type_conversion.rs:
##########
@@ -84,14 +84,87 @@ impl_primitive_from_variant!(datatypes::UInt64Type, as_u64);
 impl_primitive_from_variant!(datatypes::Float16Type, as_f16);
 impl_primitive_from_variant!(datatypes::Float32Type, as_f32);
 impl_primitive_from_variant!(datatypes::Float64Type, as_f64);
-impl_primitive_from_variant!(
-    datatypes::Date32Type,
-    as_naive_date,
-    datatypes::Date32Type::from_naive_date
-);
+impl_primitive_from_variant!(datatypes::Date32Type, as_naive_date, |v| {
+    Some(datatypes::Date32Type::from_naive_date(v))
+});
+impl_primitive_from_variant!(datatypes::Date64Type, as_naive_date, |v| {
+    Some(datatypes::Date64Type::from_naive_date(v))
+});
+impl_primitive_from_variant!(datatypes::Time32SecondType, as_time_utc, |v| {
+    // Return None if there are leftover nanoseconds

Review Comment:
   this makes sense to me -- we return None because we can't cast without 
losing precision



-- 
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