kazuyukitanimura commented on PR #1318:
URL: 
https://github.com/apache/datafusion-comet/pull/1318#issuecomment-2608579793

   Duplicated case match @andygrove @parthchandra 
   native/spark-expr/src/utils.rs
   ```
           DataType::Timestamp(TimeUnit::Microsecond, Some(_)) => {
               assert!(!timezone.is_empty());
               let array = 
as_primitive_array::<TimestampMicrosecondType>(&array);
               let array_with_timezone = 
array.clone().with_timezone(timezone.clone());
               let array = Arc::new(array_with_timezone) as ArrayRef;
               match to_type {
                   Some(DataType::Utf8) | Some(DataType::Date32) => {
                       pre_timestamp_cast(array, timezone)
                   }
                   _ => Ok(array),
               }
           }
           DataType::Timestamp(TimeUnit::Millisecond, Some(_)) => {
               assert!(!timezone.is_empty());
               let array = 
as_primitive_array::<TimestampMillisecondType>(&array);
               let array_with_timezone = 
array.clone().with_timezone(timezone.clone());
               let array = Arc::new(array_with_timezone) as ArrayRef;
               match to_type {
                   Some(DataType::Utf8) | Some(DataType::Date32) => {
                       pre_timestamp_cast(array, timezone)
                   }
                   _ => Ok(array),
               }
           }
   ...
           DataType::Timestamp(TimeUnit::Microsecond, None) => {
               let array = 
as_primitive_array::<TimestampMicrosecondType>(&array);
               let tz: Tz = tz.parse()?;
               let array: PrimitiveArray<TimestampMicrosecondType> = 
array.try_unary(|value| {
                   as_datetime::<TimestampMicrosecondType>(value)
                       .ok_or_else(|| datetime_cast_err(value))
                       .map(|local_datetime| {
                           let datetime: DateTime<Tz> =
                               tz.from_local_datetime(&local_datetime).unwrap();
                           datetime.timestamp_micros()
                       })
               })?;
               let array_with_tz = if let Some(to_tz) = to_timezone {
                   array.with_timezone(to_tz)
               } else {
                   array
               };
               Ok(Arc::new(array_with_tz))
           }
           DataType::Timestamp(TimeUnit::Millisecond, None) => {
               let array = 
as_primitive_array::<TimestampMillisecondType>(&array);
               let tz: Tz = tz.parse()?;
               let array: PrimitiveArray<TimestampMillisecondType> = 
array.try_unary(|value| {
                   as_datetime::<TimestampMillisecondType>(value)
                       .ok_or_else(|| datetime_cast_err(value))
                       .map(|local_datetime| {
                           let datetime: DateTime<Tz> =
                               tz.from_local_datetime(&local_datetime).unwrap();
                           datetime.timestamp_millis()
                       })
               })?;
               let array_with_tz = if let Some(to_tz) = to_timezone {
                   array.with_timezone(to_tz)
               } else {
                   array
               };
               Ok(Arc::new(array_with_tz))
           }
   ```


-- 
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...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to