bboissin opened a new issue, #9824:
URL: https://github.com/apache/arrow-rs/issues/9824

   **Describe the bug**
   
   When converting a Date32 outside the range of usec or nanos, 
cast()/cast_with_options() overflows.
   
   **To Reproduce**
   
       #[test]
       fn test_cast_date32_to_timestamp_ns_overflow() {
           // 2262-04-11, 2062-04-12
           let a = Date32Array::from(vec![Some(106751), Some(106752), None]);
           let array = Arc::new(a) as ArrayRef;
           let err = cast_with_options(
               &array,
               &DataType::Timestamp(TimeUnit::Nanosecond, None),
               &CastOptions {
                   safe: false,
                   format_options: FormatOptions::default(),
               },
           );
           assert!(err.is_err());
   
           let b = cast(&array, &DataType::Timestamp(TimeUnit::Nanosecond, 
None)).unwrap();
           let c = b
               .as_any()
               .downcast_ref::<TimestampNanosecondArray>()
               .unwrap();
           assert_eq!(9223286400000000000, c.value(0));
           assert!(c.is_null(1));
           assert!(c.is_null(2));
       }
   
   **Expected behavior**
   
   Behaves similar to the unittest instead of panicing.
   
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->


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