tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hj...@apache.org
Subject [18/29] tajo git commit: TAJO-1191: Change DateDatum timezone to UTC. (Jaewoong Jung via hyunsik)
Date Fri, 05 Dec 2014 08:21:22 GMT
TAJO-1191: Change DateDatum timezone to UTC. (Jaewoong Jung via hyunsik)

Closes #278


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/97507e45
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/97507e45
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/97507e45

Branch: refs/heads/hbase_storage
Commit: 97507e45883c9db2fec2f5a9a9e544384a86ccd0
Parents: 9f8be1a
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Thu Dec 4 16:12:25 2014 +0900
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Thu Dec 4 16:12:25 2014 +0900

----------------------------------------------------------------------
 CHANGES                                                  |  2 ++
 .../src/main/java/org/apache/tajo/datum/DateDatum.java   | 11 +----------
 .../main/java/org/apache/tajo/datum/IntervalDatum.java   |  1 -
 .../src/main/java/org/apache/tajo/datum/TimeDatum.java   |  4 ----
 .../java/org/apache/tajo/datum/TestIntervalDatum.java    |  8 ++++----
 5 files changed, 7 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/97507e45/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 60aa3e0..a697afe 100644
--- a/CHANGES
+++ b/CHANGES
@@ -83,6 +83,8 @@ Release 0.9.1 - unreleased
 
   BUG FIXES
 
+    TAJO-1191: Change DateDatum timezone to UTC. (Jaewoong Jung via hyunsik)
+
     TAJO-1224: When there is no projected column, json scan can be hang. 
     (hyunsik) 
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/97507e45/tajo-common/src/main/java/org/apache/tajo/datum/DateDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/DateDatum.java b/tajo-common/src/main/java/org/apache/tajo/datum/DateDatum.java
index 3296d4f..188d226 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/DateDatum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/DateDatum.java
@@ -31,6 +31,7 @@ import org.apache.tajo.util.datetime.TimeMeta;
 public class DateDatum extends Datum {
   public static final int SIZE = 4;
 
+  // Dates are stored in UTC.
   private int year;
   private int monthOfYear;
   private int dayOfMonth;
@@ -119,17 +120,12 @@ public class DateDatum extends Datum {
         if (interval.getMonths() > 0) {
           tm.plusMonths(interval.getMonths());
         }
-        DateTimeUtil.toUTCTimezone(tm);
         return new TimestampDatum(DateTimeUtil.toJulianTimestamp(tm));
       }
       case TIME: {
         TimeMeta tm1 = toTimeMeta();
-
         TimeMeta tm2 = ((TimeDatum)datum).toTimeMeta();
-        DateTimeUtil.toUserTimezone(tm2);     //TimeDatum is UTC
-
         tm1.plusTime(DateTimeUtil.toTime(tm2));
-        DateTimeUtil.toUTCTimezone(tm1);
         return new TimestampDatum(DateTimeUtil.toJulianTimestamp(tm1));
       }
       default:
@@ -155,17 +151,12 @@ public class DateDatum extends Datum {
           tm.plusMonths(0 - interval.getMonths());
         }
         tm.plusMillis(0 - interval.getMilliSeconds());
-        DateTimeUtil.toUTCTimezone(tm);
         return new TimestampDatum(DateTimeUtil.toJulianTimestamp(tm));
       }
       case TIME: {
         TimeMeta tm1 = toTimeMeta();
-
         TimeMeta tm2 = ((TimeDatum)datum).toTimeMeta();
-        DateTimeUtil.toUserTimezone(tm2);     //TimeDatum is UTC
-
         tm1.plusTime(0 - DateTimeUtil.toTime(tm2));
-        DateTimeUtil.toUTCTimezone(tm1);
         return new TimestampDatum(DateTimeUtil.toJulianTimestamp(tm1));
       }
       case DATE: {

http://git-wip-us.apache.org/repos/asf/tajo/blob/97507e45/tajo-common/src/main/java/org/apache/tajo/datum/IntervalDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/IntervalDatum.java b/tajo-common/src/main/java/org/apache/tajo/datum/IntervalDatum.java
index c6f3922..6207891 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/IntervalDatum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/IntervalDatum.java
@@ -236,7 +236,6 @@ public class IntervalDatum extends Datum {
         if (getMonths() > 0) {
           tm.plusMonths(getMonths());
         }
-        DateTimeUtil.toUTCTimezone(tm);
         return new TimestampDatum(DateTimeUtil.toJulianTimestamp(tm));
       }
       case TIME: {

http://git-wip-us.apache.org/repos/asf/tajo/blob/97507e45/tajo-common/src/main/java/org/apache/tajo/datum/TimeDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/TimeDatum.java b/tajo-common/src/main/java/org/apache/tajo/datum/TimeDatum.java
index 37e5e78..6cac586 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/TimeDatum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/TimeDatum.java
@@ -128,13 +128,9 @@ public class TimeDatum extends Datum {
       }
       case DATE: {
         TimeMeta tm = toTimeMeta();
-        DateTimeUtil.toUserTimezone(tm);     //TimeDatum is UTC
-
         DateDatum dateDatum = (DateDatum) datum;
         TimeMeta dateTm = dateDatum.toTimeMeta();
         dateTm.plusTime(DateTimeUtil.toTime(tm));
-
-        DateTimeUtil.toUTCTimezone(dateTm);
         return new TimestampDatum(DateTimeUtil.toJulianTimestamp(dateTm));
       }
       default:

http://git-wip-us.apache.org/repos/asf/tajo/blob/97507e45/tajo-common/src/test/java/org/apache/tajo/datum/TestIntervalDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestIntervalDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestIntervalDatum.java
index 511b356..2646ee7 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestIntervalDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestIntervalDatum.java
@@ -79,13 +79,13 @@ public class TestIntervalDatum {
     datum = DatumFactory.createDate(2001, 9, 28);
     Datum result = datum.plus(new IntervalDatum(60 * 60 * 1000));
     assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
-    assertEquals("2001-09-28 01:00:00", ((TimestampDatum)result).asChars(TajoConf.getCurrentTimeZone(),
false));
+    assertEquals("2001-09-28 01:00:00", result.asChars());
 
     // interval '1 hour' +  date '2001-09-28'	==> timestamp '2001-09-28 01:00:00'
     datum = new IntervalDatum(60 * 60 * 1000);
     result = datum.plus(DatumFactory.createDate(2001, 9, 28));
     assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
-    assertEquals("2001-09-28 01:00:00", ((TimestampDatum)result).asChars(TajoConf.getCurrentTimeZone(),
false));
+    assertEquals("2001-09-28 01:00:00", result.asChars());
 
     // date '2001-09-28' + time '03:00' ==> timestamp '2001-09-28 03:00:00'
     datum = DatumFactory.createDate(2001, 9, 28);
@@ -133,14 +133,14 @@ public class TestIntervalDatum {
     datum = DatumFactory.createDate(2001, 9, 28);
     result = datum.minus(new IntervalDatum(1 * 60 * 60 * 1000));
     assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
-    assertEquals("2001-09-27 23:00:00", ((TimestampDatum)result).asChars(TajoConf.getCurrentTimeZone(),
false));
+    assertEquals("2001-09-27 23:00:00", result.asChars());
 
     // date '2001-09-28' - interval '1 day 1 hour' ==> timestamp '2001-09-26 23:00:00'
     // In this case all datums are UTC
     datum = DatumFactory.createDate(2001, 9, 28);
     result = datum.minus(new IntervalDatum(IntervalDatum.DAY_MILLIS + 1 * 60 * 60 * 1000));
     assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
-    assertEquals("2001-09-26 23:00:00",  ((TimestampDatum)result).asChars(TajoConf.getCurrentTimeZone(),
false));
+    assertEquals("2001-09-26 23:00:00",  result.asChars());
 
     // time '05:00' - time '03:00' ==>	interval '02:00:00'
     datum = new TimeDatum(DateTimeUtil.toTime(5, 0, 0, 0));


Mime
View raw message