carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [14/23] carbondata git commit: [CARBONDATA-1477] Corrected the Bug For Wrong Values Of Date data type in hive
Date Thu, 21 Sep 2017 00:27:24 GMT
[CARBONDATA-1477] Corrected the Bug For Wrong Values Of Date data type in hive

This closes #1356


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

Branch: refs/heads/streaming_ingest
Commit: c2574688f82d4bd9bfea6e33d04d2ae1f96ea0f1
Parents: 7e5e29c
Author: anubhav100 <anubhav.tarar@knoldus.in>
Authored: Wed Sep 13 17:50:19 2017 +0530
Committer: chenliang613 <chenliang613@apache.org>
Committed: Mon Sep 18 16:06:36 2017 +0800

----------------------------------------------------------------------
 .../carbondata/hive/CarbonDictionaryDecodeReadSupport.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/c2574688/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonDictionaryDecodeReadSupport.java
----------------------------------------------------------------------
diff --git a/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonDictionaryDecodeReadSupport.java
b/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonDictionaryDecodeReadSupport.java
index 76597fd..34a1936 100644
--- a/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonDictionaryDecodeReadSupport.java
+++ b/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonDictionaryDecodeReadSupport.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.sql.Date;
 import java.sql.Timestamp;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.List;
 
 import org.apache.carbondata.core.cache.Cache;
@@ -228,9 +229,13 @@ public class CarbonDictionaryDecodeReadSupport<T> implements CarbonReadSupport<T
       case LONG:
         return new LongWritable((long) obj);
       case SHORT:
-        return new ShortWritable((Short) obj);
+        return new ShortWritable((short) obj);
       case DATE:
-        return new DateWritable(new Date(((Integer) obj).longValue()));
+        Calendar c = Calendar.getInstance();
+        c.setTime(new Date(0));
+        c.add(Calendar.DAY_OF_YEAR, (Integer) obj);
+        Date date = new java.sql.Date(c.getTime().getTime());
+        return new DateWritable(date);
       case TIMESTAMP:
         return new TimestampWritable(new Timestamp((long) obj / 1000));
       case STRING:


Mime
View raw message