Repository: tajo
Updated Branches:
  refs/heads/master e01b00a7b -> f45e74f6e


TAJO-1162: to_char() returns "-00" second.

Closes #234


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

Branch: refs/heads/master
Commit: f45e74f6efd1175c4eb97dbbcd38c702e29031a0
Parents: e01b00a
Author: HyoungJun Kim <[email protected]>
Authored: Tue Nov 11 10:36:29 2014 +0900
Committer: HyoungJun Kim <[email protected]>
Committed: Tue Nov 11 10:36:29 2014 +0900

----------------------------------------------------------------------
 CHANGES                                                        | 2 ++
 .../java/org/apache/tajo/util/datetime/DateTimeFormat.java     | 2 +-
 .../org/apache/tajo/engine/function/TestDateTimeFunctions.java | 6 ++++++
 3 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/f45e74f6/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 6c53920..950a108 100644
--- a/CHANGES
+++ b/CHANGES
@@ -36,6 +36,8 @@ Release 0.9.1 - unreleased
     (Jongyoung Park via hyunsik)
 
   BUG FIXES
+    
+    TAJO-1162: to_char() returns "-00" second. (Hyoungjun Kim)
 
     TAJO-1154: TajoCli doesn't pause while running the non-forwarded 
     query. (Hyoungjun Kim via hyunsik)

http://git-wip-us.apache.org/repos/asf/tajo/blob/f45e74f6/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeFormat.java
----------------------------------------------------------------------
diff --git 
a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeFormat.java 
b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeFormat.java
index c0b9245..c47c359 100644
--- 
a/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeFormat.java
+++ 
b/tajo-common/src/main/java/org/apache/tajo/util/datetime/DateTimeFormat.java
@@ -1679,7 +1679,7 @@ public class DateTimeFormat {
    */
   private static String formatInteger(int value, int size) {
     char[] targetArray, tempArray;
-    final boolean isPositive = value>0;
+    final boolean isPositive = value>=0;
     final int tempValue = isPositive?value:-value;
     int targetArraySize;
     

http://git-wip-us.apache.org/repos/asf/tajo/blob/f45e74f6/tajo-core/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
----------------------------------------------------------------------
diff --git 
a/tajo-core/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
 
b/tajo-core/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
index ab8772b..619bc5b 100644
--- 
a/tajo-core/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
+++ 
b/tajo-core/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
@@ -104,6 +104,12 @@ public class TestDateTimeFunctions extends ExprTestBase {
     // (expectedTimestamp / 1000) means the translation from millis seconds to 
unix timestamp
     String q = String.format("select to_char(to_timestamp(%d), 'yyyy-MM');", 
(expectedTimestamp / 1000));
     testSimpleEval(q, new String[]{expectedDateTime.toString(dateFormatStr)});
+
+    q = "select to_char(to_timestamp('1997-12-30 11:40:00', 'YYYY-MM-DD 
HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')";
+    testSimpleEval(q, new String[]{"1997-12-30 11:40:00"});
+
+    q = "select to_char(to_timestamp('1997-12-30 00:00:00', 'YYYY-MM-DD 
HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')";
+    testSimpleEval(q, new String[]{"1997-12-30 00:00:00"});
   }
 
   @Test

Reply via email to