kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [13/50] [abbrv] kylin git commit: minor, unknown precision for char should be 255
Date Fri, 01 Sep 2017 02:54:49 GMT
minor, unknown precision for char should be 255


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

Branch: refs/heads/master
Commit: 909628ff6d128639eb813d616fe7281295378619
Parents: 788c731
Author: Hongbin Ma <mahongbin@apache.org>
Authored: Mon Aug 21 22:21:25 2017 +0800
Committer: Hongbin Ma <ma@kyligence.io>
Committed: Mon Aug 21 22:55:59 2017 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/metadata/datatype/DataType.java     | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/909628ff/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
b/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
index 83b2391..66ff581 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
@@ -164,14 +164,16 @@ public class DataType implements Serializable {
                 try {
                     n = Integer.parseInt(parts[i]);
                 } catch (NumberFormatException e) {
-                    throw new IllegalArgumentException("bad data type -- " + datatype + ",
precision/scale not numeric");
+                    throw new IllegalArgumentException(
+                            "bad data type -- " + datatype + ", precision/scale not numeric");
                 }
                 if (i == 0)
                     precision = n;
                 else if (i == 1)
                     scale = n;
                 else
-                    throw new IllegalArgumentException("bad data type -- " + datatype + ",
too many precision/scale parts");
+                    throw new IllegalArgumentException(
+                            "bad data type -- " + datatype + ", too many precision/scale
parts");
             }
         }
 
@@ -179,6 +181,9 @@ public class DataType implements Serializable {
         if ((name.equals("char") || name.equals("varchar")) && precision == -1) {
             precision = 256; // to save memory at frontend, e.g. tableau will
                              // allocate memory according to this
+            if (name.equals("char")) {
+                precision -= 1; //at most 255 according to https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-CharcharChar
+            }
         }
 
         // FIXME (19,4) for unknown decimal precision
@@ -217,7 +222,7 @@ public class DataType implements Serializable {
     public boolean isTimeFamily() {
         return DATETIME_FAMILY.contains(name) && !isDate();
     }
-    
+
     public boolean isDate() {
         return name.equals("date");
     }


Mime
View raw message