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

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   It looks like `date_part` using an interval will return the whole interval 
instead of taking out the part.
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   ```rust
   use arrow::array::{Int32Array, IntervalMonthDayNanoArray, 
TimestampSecondArray};
   use arrow::compute::{date_part, DatePart};
   use arrow::datatypes::IntervalMonthDayNano;
   
   fn main() -> Result<(), Box<dyn std::error::Error>> {
       let array = TimestampSecondArray::from(vec![305]); // 5 minutes, 5 
seconds
       let result = date_part(&array, DatePart::Second)?
           .as_any()
           .downcast_ref::<Int32Array>()
           .unwrap()
           .iter()
           .collect::<Vec<Option<i32>>>();
       assert_eq!(result, &[Some(5)]); // As expected
   
       let array = IntervalMonthDayNanoArray::from(vec![
           IntervalMonthDayNano::new(0, 0, 305 * 1_000_000_000), // 0 months, 0 
days, 305 seconds
       ]);
       let res: Vec<Option<i32>> = date_part(&array, DatePart::Second)?
           .as_any()
           .downcast_ref::<Int32Array>()
           .unwrap()
           .iter()
           .collect::<Vec<Option<i32>>>();
       assert_eq!(res, &[Some(5)]); // Fails, result is 305
   
       Ok(())
   }
   ```
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   `date_part` returns the requested part.
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->
   https://github.com/apache/datafusion/issues/14817


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