Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimestampWithTimeZone not handling ambiguous values #24003

Open
yuandagits opened this issue Nov 11, 2024 · 0 comments
Open

TimestampWithTimeZone not handling ambiguous values #24003

yuandagits opened this issue Nov 11, 2024 · 0 comments
Labels

Comments

@yuandagits
Copy link

Presto is returning different values for date_add(-7, FOO_TIME) and FOO_TIME - INTERVAL '7' HOUR. Specifically, when a string is passed into parse_datetime(), and the output of this fed into date_trunc('hour', ...) - INTERVAL '7' HOUR, we are observing two different values.

We think that this may be an issue with TimestampWithTImeZones here:

@ScalarOperator(ADD)
@SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE)
public static long timestampWithTimeZonePlusIntervalDayToSecond(@SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE) long left, @SqlType(StandardTypes.INTERVAL_DAY_TO_SECOND) long right)
{
return updateMillisUtc(unpackMillisUtc(left) + right, left);
not handling timezones in the case of ambiguous values.

Expected Behavior

select to_unixtime(date_trunc('hour',
    parse_datetime(
        concat(substr('2024-11-03+07:00:99', 1, 17), '00'),
        'yyyy-MM-dd+HH:mm:ss'
    ) - INTERVAL '7' HOUR)) -> 1,730,620,800


select to_unixtime(date_trunc('hour',
    parse_datetime(
        concat(substr('2024-11-03+08:00:99', 1, 17), '00'),
        'yyyy-MM-dd+HH:mm:ss'
    ) - INTERVAL '7' HOUR)) -> 1,730,620,800

Current Behavior

select to_unixtime(date_trunc('hour',
    parse_datetime(
        concat(substr('2024-11-03+08:00:99', 1, 17), '00'),
        'yyyy-MM-dd+HH:mm:ss'
    ) - INTERVAL '7' HOUR)) -> 1,730,624,400
  
select to_unixtime(date_trunc('hour',
    parse_datetime(
        concat(substr('2024-11-03+07:00:99', 1, 17), '00'),
        'yyyy-MM-dd+HH:mm:ss'
    ) - INTERVAL '7' HOUR)) -> 1,730,620,800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🆕 Unprioritized
Development

No branches or pull requests

1 participant