alamb commented on code in PR #8430:
URL: https://github.com/apache/arrow-datafusion/pull/8430#discussion_r1420799118


##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -403,123 +404,61 @@ pub fn date_trunc(args: &[ColumnarValue]) -> 
Result<ColumnarValue> {
             return exec_err!("Granularity of `date_trunc` must be non-null 
scalar Utf8");
         };
 
+    fn process_array<T: ArrowTimestampType>(
+        array: &dyn Array,
+        granularity: String,
+        tz_opt: &Option<Arc<str>>,
+    ) -> Result<ColumnarValue> {
+        let parsed_tz = parse_tz(tz_opt)?;
+        let array = as_primitive_array::<T>(array)?;
+        let array = array
+            .iter()
+            .map(|x| general_date_trunc(T::UNIT, &x, parsed_tz, 
granularity.as_str()))
+            .collect::<Result<PrimitiveArray<T>>>()?
+            .with_timezone_opt(tz_opt.clone());
+        Ok(ColumnarValue::Array(Arc::new(array)))
+    }
+
+    fn process_scalr<T: ArrowTimestampType>(

Review Comment:
   I believe there is a typo here: 
   
   ```suggestion
       fn process_scalar<T: ArrowTimestampType>(
   ```



##########
datafusion/common/src/scalar.rs:
##########
@@ -796,6 +797,20 @@ impl ScalarValue {
         ScalarValue::IntervalMonthDayNano(Some(val))
     }
 
+    /// Returns a [`ScalarValue`] representing

Review Comment:
   This is a nice function 👍 



##########
datafusion/common/src/scalar.rs:
##########
@@ -796,6 +797,20 @@ impl ScalarValue {
         ScalarValue::IntervalMonthDayNano(Some(val))
     }
 
+    /// Returns a [`ScalarValue`] representing

Review Comment:
   This is a nice function 👍 



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