kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [08/50] [abbrv] kylin git commit: KYLIN-2010 retire 'time' and 'date' encoding, rollback to use dictionary
Date Tue, 27 Sep 2016 00:34:32 GMT
KYLIN-2010 retire 'time' and 'date' encoding, rollback to use dictionary


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

Branch: refs/heads/1.5.x-CDH5.7
Commit: a768b65d608cb6c1d0dbb7bcadf4adbd97a7b1f6
Parents: 506cd78
Author: Li Yang <liyang@apache.org>
Authored: Tue Sep 20 18:29:20 2016 +0800
Committer: Li Yang <liyang@apache.org>
Committed: Tue Sep 20 18:30:14 2016 +0800

----------------------------------------------------------------------
 .../apache/kylin/cube/model/RowKeyColDesc.java  | 15 ++++--------
 .../org/apache/kylin/dimension/DateDimEnc.java  | 24 +++++++++++---------
 .../dimension/DimensionEncodingFactory.java     |  2 --
 .../org/apache/kylin/dimension/TimeDimEnc.java  | 24 +++++++++++---------
 4 files changed, 30 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/a768b65d/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..296c1a3 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
@@ -26,7 +26,6 @@ import org.apache.kylin.dimension.DictionaryDimEnc;
 import org.apache.kylin.dimension.DimensionEncoding;
 import org.apache.kylin.dimension.DimensionEncodingFactory;
 import org.apache.kylin.dimension.TimeDimEnc;
-import org.apache.kylin.metadata.datatype.DataType;
 import org.apache.kylin.metadata.model.TblColRef;
 
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
@@ -38,8 +37,8 @@ import com.google.common.base.Preconditions;
 
 /**
  * @author yangli9
- * 
  */
+@SuppressWarnings("deprecation")
 @JsonAutoDetect(fieldVisibility = Visibility.NONE, getterVisibility = Visibility.NONE, isGetterVisibility
= Visibility.NONE, setterVisibility = Visibility.NONE)
 public class RowKeyColDesc {
 
@@ -75,15 +74,9 @@ 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
-        if (DictionaryDimEnc.ENCODING_NAME.equals(encodingName)) {
-            DataType type = colRef.getType();
-            if (type.isDate()) {
-                encoding = encodingName = DateDimEnc.ENCODING_NAME;
-            }
-            if (type.isTime() || type.isTimestamp() || type.isDatetime()) {
-                encoding = encodingName = TimeDimEnc.ENCODING_NAME;
-            }
+        // convert date/time encoding to dictionary, because encoding does not remember date
pattern and cannot format string correctly at query time
+        if (DateDimEnc.ENCODING_NAME.equals(encodingName) || TimeDimEnc.ENCODING_NAME.equals(encodingName))
{
+            throw new IllegalStateException("Encoding '" + DateDimEnc.ENCODING_NAME + "'
and '" + TimeDimEnc.ENCODING_NAME + "' are deprecated, please use dictionary encoding instead");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/a768b65d/core-metadata/src/main/java/org/apache/kylin/dimension/DateDimEnc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/dimension/DateDimEnc.java b/core-metadata/src/main/java/org/apache/kylin/dimension/DateDimEnc.java
index 79e00ce..3992ed7 100644
--- a/core-metadata/src/main/java/org/apache/kylin/dimension/DateDimEnc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/dimension/DateDimEnc.java
@@ -20,6 +20,8 @@ package org.apache.kylin.dimension;
 
 /**
  * This encoding is meant to be IDENTICAL to DateStrDictionary for 100% backward compatibility.
+ * 
+ * @deprecated for now, please use dictionary 
  */
 public class DateDimEnc extends AbstractDateDimEnc {
     private static final long serialVersionUID = 1L;
@@ -28,17 +30,17 @@ public class DateDimEnc extends AbstractDateDimEnc {
 
     public static final String ENCODING_NAME = "date";
 
-    public static class Factory extends DimensionEncodingFactory {
-        @Override
-        public String getSupportedEncodingName() {
-            return ENCODING_NAME;
-        }
-
-        @Override
-        public DimensionEncoding createDimensionEncoding(String encodingName, String[] args)
{
-            return new DateDimEnc();
-        }
-    };
+//    public static class Factory extends DimensionEncodingFactory {
+//        @Override
+//        public String getSupportedEncodingName() {
+//            return ENCODING_NAME;
+//        }
+//
+//        @Override
+//        public DimensionEncoding createDimensionEncoding(String encodingName, String[]
args) {
+//            return new DateDimEnc();
+//        }
+//    };
 
     public DateDimEnc() {
         super(3, new IMillisCodec() {

http://git-wip-us.apache.org/repos/asf/kylin/blob/a768b65d/core-metadata/src/main/java/org/apache/kylin/dimension/DimensionEncodingFactory.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/dimension/DimensionEncodingFactory.java
b/core-metadata/src/main/java/org/apache/kylin/dimension/DimensionEncodingFactory.java
index 739fa25..bc4bf5c 100644
--- a/core-metadata/src/main/java/org/apache/kylin/dimension/DimensionEncodingFactory.java
+++ b/core-metadata/src/main/java/org/apache/kylin/dimension/DimensionEncodingFactory.java
@@ -77,8 +77,6 @@ public abstract class DimensionEncodingFactory {
             map.put(IntegerDimEnc.ENCODING_NAME, new IntegerDimEnc.Factory());
             map.put(SlimLongDimEnc.ENCODING_NAME, new SlimLongDimEnc.Factory());
             map.put(FixedLenHexDimEnc.ENCODING_NAME, new FixedLenHexDimEnc.Factory());
-            map.put(DateDimEnc.ENCODING_NAME, new DateDimEnc.Factory());
-            map.put(TimeDimEnc.ENCODING_NAME, new TimeDimEnc.Factory());
 
             // custom encodings
             String[] clsNames = KylinConfig.getInstanceFromEnv().getCubeDimensionCustomEncodingFactories();

http://git-wip-us.apache.org/repos/asf/kylin/blob/a768b65d/core-metadata/src/main/java/org/apache/kylin/dimension/TimeDimEnc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/dimension/TimeDimEnc.java b/core-metadata/src/main/java/org/apache/kylin/dimension/TimeDimEnc.java
index 8c66d5d..245f513 100644
--- a/core-metadata/src/main/java/org/apache/kylin/dimension/TimeDimEnc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/dimension/TimeDimEnc.java
@@ -20,23 +20,25 @@ package org.apache.kylin.dimension;
 
 /**
  * This encoding is meant to be IDENTICAL to TimeStrDictionary for 100% backward compatibility.
+ * 
+ * @deprecated for now, please use dictionary 
  */
 public class TimeDimEnc extends AbstractDateDimEnc {
     private static final long serialVersionUID = 1L;
 
     public static final String ENCODING_NAME = "time";
 
-    public static class Factory extends DimensionEncodingFactory {
-        @Override
-        public String getSupportedEncodingName() {
-            return ENCODING_NAME;
-        }
-
-        @Override
-        public DimensionEncoding createDimensionEncoding(String encodingName, String[] args)
{
-            return new TimeDimEnc();
-        }
-    };
+//    public static class Factory extends DimensionEncodingFactory {
+//        @Override
+//        public String getSupportedEncodingName() {
+//            return ENCODING_NAME;
+//        }
+//
+//        @Override
+//        public DimensionEncoding createDimensionEncoding(String encodingName, String[]
args) {
+//            return new TimeDimEnc();
+//        }
+//    };
 
     public TimeDimEnc() {
         super(4, new IMillisCodec() {


Mime
View raw message