You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tajo.apache.org by "Hyunsik Choi (JIRA)" <ji...@apache.org> on 2017/12/03 21:43:00 UTC

[jira] [Commented] (TAJO-2186) TestResultSet.testDateTimeType fails in UTC timezone

    [ https://issues.apache.org/jira/browse/TAJO-2186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16276109#comment-16276109 ] 

Hyunsik Choi commented on TAJO-2186:
------------------------------------

Please see some part of testDateTimeType test

{code:title=TestResultSet.java|lineNumber=123}
      // assert with timezone
      // Current timezone + 1 hour
      TimeZone tz = TimeZone.getDefault();
      tz.setRawOffset(tz.getRawOffset() + (int) TimeUnit.HOURS.toMillis(1));

      Calendar cal = Calendar.getInstance(tz);
      assertEquals(tz.getRawOffset(), cal.getTimeZone().getRawOffset());

      assertEquals(Time.valueOf("23:00:00"), res.getTime(1, cal)); // <------ Here
{code}

See the last line. A Time object contains a calander object, and the calanedar object is used for equals(). {{Time.valueOf()}} internally uses Timezone.getDefault(), but {{res.getTime()}} uses a timezone derived from a given calendar object. That's why it causes this failure in some timezone.


> TestResultSet.testDateTimeType fails in UTC timezone
> ----------------------------------------------------
>
>                 Key: TAJO-2186
>                 URL: https://issues.apache.org/jira/browse/TAJO-2186
>             Project: Tajo
>          Issue Type: Bug
>         Environment: Linux, Mac OS X
>            Reporter: Hyunsik Choi
>             Fix For: 0.12.0
>
>
> Please see this travis log. TestResultSet.testDateTimeType failed. I looked into this issue. I found that this test fails if the timezone is UTC. You can reproduce as follows:
> {noformat}
> $ cd tajo-jdbc
> $ export TZ=UTC
> $ mvn test
> ...
> 2017-12-03 10:05:09,386 INFO: org.apache.tajo.catalog.store.DerbyStore (shutdown(75)) - Shutdown database
> Results :
> Failed tests: 
>   TestResultSet.testDateTimeType:243 expected: java.sql.Time<23:00:00> but was: java.sql.Time<23:00:00>
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)