jacktengg commented on code in PR #70003:
URL: https://github.com/apache/doris/pull/70003#discussion_r4559485266
##########
be/src/core/value/timestamptz_value.cpp:
##########
@@ -168,7 +197,9 @@ void TimestampTzValue::convert_local_to_utc(const
cctz::time_zone& local_time_zo
cctz::civil_second local_cs(dt.year(), dt.month(), dt.day(), dt.hour(),
dt.minute(),
dt.second());
const auto lookup = local_time_zone.lookup(local_cs);
- cctz::time_point<cctz::seconds> local_tp = cctz::convert(local_cs,
local_time_zone);
+ // Use the pre-transition offset to shift gap input by the gap length,
e.g. New York's
+ // 2024-03-10 02:30 becomes 03:30. The preferred offset applies only to an
overlap.
+ auto local_tp = lookup.pre;
Review Comment:
The behaviour is fixed in pr https://github.com/apache/doris/pull/70204 and
aligned with PostgreSQL(tested with PostgreSQL 18):
```
SET TimeZone='America/New_York';
SET DateStyle='ISO,YMD';
WITH x AS(SELECT TIMESTAMPTZ '2024-03-10 03:15:00-04:00' as t, TIMESTAMPTZ
'2024-03-09 00:30:00-05:00' AS o)
select date_bin(interval '1 hour', t, o) as duration_grid from x;
|duration_grid|
|2024-03-10 01:30:00-05|
```
--
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]