Repository: incubator-carbondata Updated Branches: refs/heads/master b2eb9c744 -> 254af99a7
Fixed Date issue when date is less the 1970 Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/c33e5b29 Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/c33e5b29 Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/c33e5b29 Branch: refs/heads/master Commit: c33e5b29f196a7f409a993a0c489950e91747cd9 Parents: b2eb9c7 Author: kumarvishal <kumarvishal.1...@gmail.com> Authored: Fri Jan 20 21:19:36 2017 +0800 Committer: ravipesala <ravi.pes...@gmail.com> Committed: Fri Jan 20 20:56:07 2017 +0530 ---------------------------------------------------------------------- .../timestamp/DateDirectDictionaryGenerator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c33e5b29/core/src/main/java/org/apache/carbondata/core/keygenerator/directdictionary/timestamp/DateDirectDictionaryGenerator.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/core/keygenerator/directdictionary/timestamp/DateDirectDictionaryGenerator.java b/core/src/main/java/org/apache/carbondata/core/keygenerator/directdictionary/timestamp/DateDirectDictionaryGenerator.java index 5572f70..8db42b0 100644 --- a/core/src/main/java/org/apache/carbondata/core/keygenerator/directdictionary/timestamp/DateDirectDictionaryGenerator.java +++ b/core/src/main/java/org/apache/carbondata/core/keygenerator/directdictionary/timestamp/DateDirectDictionaryGenerator.java @@ -35,6 +35,7 @@ import org.apache.carbondata.core.util.CarbonProperties; */ public class DateDirectDictionaryGenerator implements DirectDictionaryGenerator { + private static final int cutOffDate = Integer.MAX_VALUE >> 1; private static final long SECONDS_PER_DAY = 60 * 60 * 24L; private static final long MILLIS_PER_DAY = SECONDS_PER_DAY * 1000L; @@ -131,7 +132,7 @@ public class DateDirectDictionaryGenerator implements DirectDictionaryGenerator if (key == 1) { return null; } - return key; + return key - cutOffDate; } private int generateDirectSurrogateKeyForNonTimestampType(String memberStr) { @@ -151,7 +152,7 @@ public class DateDirectDictionaryGenerator implements DirectDictionaryGenerator private int generateKey(long timeValue) { long milli = timeValue + threadLocalLocalTimeZone.get().getOffset(timeValue); - int key = (int) Math.floor((double) milli / MILLIS_PER_DAY); + int key = (int) Math.floor((double) milli / MILLIS_PER_DAY) + cutOffDate; return key; }