hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rui Li (JIRA)" <>
Subject [jira] [Commented] (HIVE-14412) Add a timezone-aware timestamp
Date Tue, 09 May 2017 02:12:04 GMT


Rui Li commented on HIVE-14412:

The latest failure are not related.

[~cartershanklin], the Postgres example you mentioned can be achieved with v12 patch. But
since Hive currently doesn't support session zone, user has to change system zone to do that.
I also added a test case for it:
  public void testConvertFromTimestamp() {
    TimeZone defaultZone = TimeZone.getDefault();
    try {
      // Use system zone when converting from timestamp to timestamptz
      String s = "2017-06-12 23:12:56.34";
      TimestampTZ tstz1 = TimestampTZ.convert(Timestamp.valueOf(s));
      TimestampTZ tstz2 = TimestampTZ.convert(Timestamp.valueOf(s));
      Assert.assertTrue(tstz1.compareTo(tstz2) < 0);
    } finally {
What I was trying to say is, by converting to a target timezone, users usually expect to see
the timestamp displayed in that timezone. E.g. if users want to convert '2012-01-01 08:00:00+00'
to PST8PDT, they should be expecting '2012-01-01 00:00:00-08' right? But w/o storing the zone,
all timestamptz display in UTC. Session zone doesn't seem to help because the target zone
isn't necessarily same as session zone.

> Add a timezone-aware timestamp
> ------------------------------
>                 Key: HIVE-14412
>                 URL:
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Hive
>            Reporter: Rui Li
>            Assignee: Rui Li
>         Attachments: HIVE-14412.10.patch, HIVE-14412.11.patch, HIVE-14412.12.patch, HIVE-14412.1.patch,
HIVE-14412.2.patch, HIVE-14412.3.patch, HIVE-14412.4.patch, HIVE-14412.5.patch, HIVE-14412.6.patch,
HIVE-14412.7.patch, HIVE-14412.8.patch, HIVE-14412.9.patch
> Java's Timestamp stores the time elapsed since the epoch. While it's by itself unambiguous,
ambiguity comes when we parse a string into timestamp, or convert a timestamp to string, causing
problems like HIVE-14305.
> To solve the issue, I think we should make timestamp aware of timezone.

This message was sent by Atlassian JIRA

View raw message