github-actions[bot] commented on code in PR #64029:
URL: https://github.com/apache/doris/pull/64029#discussion_r3348619647


##########
be/src/exprs/function/function_convert_tz.cpp:
##########
@@ -212,6 +212,19 @@ class FunctionConvertTZ : public IFunction {
         }
     }
 
+    static std::pair<int64_t, int64_t> unix_timestamp_for_convert_tz(
+            const DateValueType& ts_value, const cctz::time_zone& from_tz) {
+        cctz::civil_second civil_time(ts_value.year(), ts_value.month(), 
ts_value.day(),
+                                      ts_value.hour(), ts_value.minute(), 
ts_value.second());
+        const auto lookup = from_tz.lookup(civil_time);
+        const bool skipped = lookup.kind == 
cctz::time_zone::civil_lookup::SKIPPED;
+        const auto tp = skipped ? lookup.trans : lookup.pre;
+
+        // Skipped civil times map to the transition instant. Do not keep the
+        // input fractional part inside a local time interval that never 
existed.
+        return {tp.time_since_epoch().count(), skipped ? 0 : 
ts_value.microsecond()};
+    }

Review Comment:
   This changes runtime `convert_tz` to drop the DATETIMEV2 fractional part for 
every skipped civil time. For example, with `debug_skip_fold_constant=true`, 
`convert_tz('2021-03-28 02:30:00.003230', 'Europe/Paris', 'UTC')` now returns 
the transition second with `.000000`, and the updated regression output accepts 
that loss. The previous `DateV2Value::unix_timestamp(std::pair<...>)` path 
converted the civil second but carried `ts_value.microsecond()` separately, and 
other local-to-UTC paths such as `TimestampTzValue::convert_local_to_utc` still 
preserve `dt.microsecond()`. Please keep the original microsecond in the 
returned pair for `SKIPPED` as well, and update the regression/unit tests to 
assert the fractional part is preserved.



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