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 2016/09/27 00:34:38 UTC

[14/50] [abbrv] kylin git commit: KYLIN-2010 backend check date/time encoding only apply to date/time column

KYLIN-2010 backend check date/time encoding only apply to date/time column


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

Branch: refs/heads/1.5.x-CDH5.7
Commit: f0d2be3c93cde5e658178c896be1671d1aca5685
Parents: f62541e
Author: Yang Li <li...@apache.org>
Authored: Wed Sep 21 06:41:51 2016 +0800
Committer: Yang Li <li...@apache.org>
Committed: Wed Sep 21 06:41:51 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/cube/model/RowKeyColDesc.java     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/f0d2be3c/core-cube/src/main/java/org/apache/kylin/cube/model/RowKeyColDesc.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/model/RowKeyColDesc.java b/core-cube/src/main/java/org/apache/kylin/cube/model/RowKeyColDesc.java
index 8d4f862..a1d4440 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/model/RowKeyColDesc.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/model/RowKeyColDesc.java
@@ -75,9 +75,10 @@ public class RowKeyColDesc {
         if (!DimensionEncodingFactory.isVaildEncoding(this.encodingName))
             throw new IllegalArgumentException("Not supported row key col encoding: '" + this.encoding + "'");
 
-        // convert date/time dictionary to DimensionEncoding implicitly, date/time dictionary is deprecated
+        // convert date/time dictionary on date/time column to DimensionEncoding implicitly
+        // however date/time dictionary on varchar column is still required
+        DataType type = colRef.getType();
         if (DictionaryDimEnc.ENCODING_NAME.equals(encodingName)) {
-            DataType type = colRef.getType();
             if (type.isDate()) {
                 encoding = encodingName = DateDimEnc.ENCODING_NAME;
             }
@@ -85,6 +86,10 @@ public class RowKeyColDesc {
                 encoding = encodingName = TimeDimEnc.ENCODING_NAME;
             }
         }
+        if (DateDimEnc.ENCODING_NAME.equals(encodingName) && type.isDate() == false)
+            throw new IllegalArgumentException(colRef + " type is " + type + " and cannot apply date encoding");
+        if (TimeDimEnc.ENCODING_NAME.equals(encodingName) && type.isTime() == false)
+            throw new IllegalArgumentException(colRef + " type is " + type + " and cannot apply time encoding");
     }
 
     public String getEncoding() {