Copilot commented on code in PR #3265:
URL: https://github.com/apache/datafusion-comet/pull/3265#discussion_r2724324610


##########
native/spark-expr/src/datetime_funcs/extract_date_part.rs:
##########
@@ -75,14 +76,28 @@ macro_rules! extract_date_part {
 
                 match args {
                     [ColumnarValue::Array(array)] => {
-                        let array = array_with_timezone(
-                            array,
-                            self.timezone.clone(),
-                            Some(&DataType::Timestamp(
-                                Microsecond,
-                                Some(self.timezone.clone().into()),
-                            )),
-                        )?;
+                        let array = match array.data_type() {
+                            // TimestampNTZ → DO NOT apply timezone conversion
+                            DataType::Timestamp(_, None) => array.clone(),
+
+                            // Timestamp with timezone → convert from UTC to 
session timezone
+                            DataType::Timestamp(_, Some(_)) => 
array_with_timezone(
+                                array,

Review Comment:
   `invoke_with_args` now pattern-matches directly on `array.data_type()` and 
rejects `DataType::Dictionary(_, _)` with an execution error. This is a 
regression for dictionary-encoded timestamp columns (the function’s 
`return_type` explicitly supports dictionary input, and `array_with_timezone` 
also has dictionary handling). Add explicit handling for 
`DataType::Dictionary(_, value_type)` where `value_type` is `Timestamp(_, 
None)` (no conversion) or `Timestamp(_, Some(_))` (apply 
`array_with_timezone`), instead of falling into the error branch.



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

Reply via email to