You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by ji...@apache.org on 2015/03/05 07:15:55 UTC
[03/10] tajo git commit: TAJO-1366: The timestamp type conversion
occasionally leads to wrong results. (jihoon)
TAJO-1366: The timestamp type conversion occasionally leads to wrong results. (jihoon)
Closes #395
Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/f884e59a
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/f884e59a
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/f884e59a
Branch: refs/heads/index_support
Commit: f884e59a9862bafb5f85524ba4a98cab6e43d403
Parents: c65bc3a
Author: Jihoon Son <ji...@apache.org>
Authored: Tue Mar 3 14:17:34 2015 +0900
Committer: Jihoon Son <ji...@apache.org>
Committed: Tue Mar 3 14:17:34 2015 +0900
----------------------------------------------------------------------
CHANGES | 3 ++
.../tajo/util/datetime/DateTimeConstants.java | 31 ++++++++++++--------
.../apache/tajo/datum/TestTimestampDatum.java | 7 +++++
3 files changed, 28 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tajo/blob/f884e59a/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index c2b02a1..716dc59 100644
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,9 @@ Release 0.11.0 - unreleased
BUG FIXES
+ TAJO-1366: The timestamp type conversion occasionally leads to wrong
+ results. (jihoon)
+
TAJO-1365: Suppress release audit warnings on Jekins builds. (jihun)
TAJO-1357: Resolve findbugs warnings on Tajo Catalog Modules. (jihun)
http://git-wip-us.apache.org/repos/asf/tajo/blob/f884e59a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeConstants.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeConstants.java b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeConstants.java
index 102bf95..1f77f43 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeConstants.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeConstants.java
@@ -627,19 +627,24 @@ public class DateTimeConstants {
dateTokenMap.put(dateToken.key, dateToken);
}
- for (Object[] eachToken: deltatktbl) {
- DateToken dateToken = new DateToken();
- dateToken.key = eachToken[0].toString();
- dateToken.type = (TokenField)eachToken[1];
- if (eachToken[2] instanceof TokenField) {
- dateToken.valueType = (TokenField)eachToken[2];
- dateToken.value = dateToken.valueType.getValue();
- } else {
- dateToken.valueType = TokenField.DECIMAL;
- dateToken.value = ((Integer)eachToken[2]).intValue();
- }
- dateTokenMap.put(dateToken.key, dateToken);
- }
+ /*
+ * TODO
+ * Currently, tajo does not support intervals, yet.
+ * The below code must be restored to support intervals.
+ */
+// for (Object[] eachToken: deltatktbl) {
+// DateToken dateToken = new DateToken();
+// dateToken.key = eachToken[0].toString();
+// dateToken.type = (TokenField)eachToken[1];
+// if (eachToken[2] instanceof TokenField) {
+// dateToken.valueType = (TokenField)eachToken[2];
+// dateToken.value = dateToken.valueType.getValue();
+// } else {
+// dateToken.valueType = TokenField.DECIMAL;
+// dateToken.value = ((Integer)eachToken[2]).intValue();
+// }
+// dateTokenMap.put(dateToken.key, dateToken);
+// }
}
public static int INTERVAL_MASK(TokenField t) { return (1 << (t.getValue())); }
http://git-wip-us.apache.org/repos/asf/tajo/blob/f884e59a/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
index 277eefc..06e50f7 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
@@ -87,6 +87,13 @@ public class TestTimestampDatum {
assertEquals(d, copy);
}
+ @Test
+ public void testAsText2() {
+ // TAJO-1366
+ TimestampDatum datum = DatumFactory.createTimestamp("Mon Nov 03 00:03:00 +0000 2014");
+ assertEquals("2014-11-03 00:03:00", datum.asChars());
+ }
+
@Test
public final void testSize() {
Datum d = DatumFactory.createTimestmpDatumWithUnixTime(unixtime);