eejbyfeldt commented on code in PR #543:
URL: https://github.com/apache/datafusion-comet/pull/543#discussion_r1638387428
##########
core/src/execution/datafusion/expressions/utils.rs:
##########
@@ -134,36 +140,40 @@ pub fn array_with_timezone(
/// array - input array of timestamp without timezone
/// tz - timezone of the values in the input array
/// to_timezone - timezone to change the input values to
-fn timestamp_ntz_to_timestamp(array: ArrayRef, tz: &str, to_timezone:
Option<&str>) -> ArrayRef {
+fn timestamp_ntz_to_timestamp(
+ array: ArrayRef,
+ tz: &str,
+ to_timezone: Option<&str>,
+) -> Result<ArrayRef, ArrowError> {
assert!(!tz.is_empty());
match array.data_type() {
DataType::Timestamp(_, None) => {
let array = as_primitive_array::<TimestampMicrosecondType>(&array);
- let tz: Tz = tz.parse().unwrap();
- let values = array.iter().map(|v| {
- v.map(|value| {
- let local_datetime =
as_datetime::<TimestampMicrosecondType>(value).unwrap();
- let datetime: DateTime<Tz> =
tz.from_local_datetime(&local_datetime).unwrap();
- datetime.timestamp_micros()
- })
- });
- let mut array: PrimitiveArray<TimestampMicrosecondType> =
- unsafe { PrimitiveArray::from_trusted_len_iter(values) };
- array = if let Some(to_tz) = to_timezone {
+ let tz: Tz = tz.parse()?;
Review Comment:
Added in cdbf87ae47a4e2b12d76f08138105340097d00f3
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]