You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/03/28 01:05:02 UTC

[25/50] incubator-kylin git commit: accept bigint as II record timestamp

accept bigint as II record timestamp


Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/71bbd0c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/71bbd0c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/71bbd0c6

Branch: refs/heads/streaming-localdict
Commit: 71bbd0c6ceabdb53fdf485da35b60508578f9bd2
Parents: d136933
Author: Li, Yang <ya...@ebay.com>
Authored: Fri Mar 27 13:55:39 2015 +0800
Committer: Li, Yang <ya...@ebay.com>
Committed: Fri Mar 27 13:55:39 2015 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/dict/DateStrDictionary.java   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/71bbd0c6/dictionary/src/main/java/org/apache/kylin/dict/DateStrDictionary.java
----------------------------------------------------------------------
diff --git a/dictionary/src/main/java/org/apache/kylin/dict/DateStrDictionary.java b/dictionary/src/main/java/org/apache/kylin/dict/DateStrDictionary.java
index 7cace15..95f67ff 100644
--- a/dictionary/src/main/java/org/apache/kylin/dict/DateStrDictionary.java
+++ b/dictionary/src/main/java/org/apache/kylin/dict/DateStrDictionary.java
@@ -89,7 +89,9 @@ public class DateStrDictionary extends Dictionary<String> {
     }
 
     public static long stringToMillis(String str) {
-        if (str.length() == 10) {
+        if (isAllDigits(str)) {
+            return Long.parseLong(str);
+        } else if (str.length() == 10) {
             return stringToDate(str, DEFAULT_DATE_PATTERN).getTime();
         } else if (str.length() == 19) {
             return stringToDate(str, DEFAULT_DATETIME_PATTERN_WITHOUT_MILLISECONDS).getTime();
@@ -99,6 +101,14 @@ public class DateStrDictionary extends Dictionary<String> {
             throw new IllegalArgumentException("there is no valid date pattern for:" + str);
         }
     }
+    
+    private static boolean isAllDigits(String str) {
+        for (int i = 0, n = str.length(); i < n; i++) {
+            if (Character.isDigit(str.charAt(i)) == false)
+                return false;
+        }
+        return true;
+    }
 
     // ============================================================================