carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kumarvisha...@apache.org
Subject [1/2] incubator-carbondata git commit: remove unnecessary file name check in dictionary cache
Date Mon, 19 Dec 2016 12:43:57 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master f5dcbb526 -> 51463ff2e


remove unnecessary file name check in dictionary cache

fix testcase

fix comment


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

Branch: refs/heads/master
Commit: f031394a8c608097b69ab530e35bae1435ebd020
Parents: f5dcbb5
Author: jackylk <jacky.likun@huawei.com>
Authored: Mon Nov 21 22:14:06 2016 +0800
Committer: kumarvishal <kumarvishal.1802@gmail.com>
Committed: Mon Dec 19 20:40:20 2016 +0800

----------------------------------------------------------------------
 .../dictionary/DictionaryColumnUniqueIdentifier.java |  7 +++++++
 .../cache/dictionary/ForwardDictionaryCache.java     |  9 ++-------
 .../cache/dictionary/ReverseDictionaryCache.java     |  9 ++-------
 .../core/carbon/metadata/datatype/DataType.java      |  4 ++++
 .../cache/dictionary/ReverseDictionaryCacheTest.java |  3 ++-
 .../carbondata/scan/filter/FilterUtilTest.java       | 15 ---------------
 6 files changed, 17 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f031394a/core/src/main/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifier.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifier.java
b/core/src/main/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifier.java
index c9b08dc..1fee082 100644
--- a/core/src/main/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifier.java
+++ b/core/src/main/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifier.java
@@ -49,8 +49,15 @@ public class DictionaryColumnUniqueIdentifier {
    */
   public DictionaryColumnUniqueIdentifier(CarbonTableIdentifier carbonTableIdentifier,
       ColumnIdentifier columnIdentifier) {
+    if (carbonTableIdentifier == null) {
+      throw new IllegalArgumentException("carbonTableIdentifier is null");
+    }
+    if (columnIdentifier == null) {
+      throw new IllegalArgumentException("columnIdentifier is null");
+    }
     this.carbonTableIdentifier = carbonTableIdentifier;
     this.columnIdentifier = columnIdentifier;
+    this.dataType = columnIdentifier.getDataType();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f031394a/core/src/main/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCache.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCache.java
b/core/src/main/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCache.java
index d4f6adc..e6fc9d8 100644
--- a/core/src/main/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCache.java
+++ b/core/src/main/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCache.java
@@ -166,13 +166,8 @@ public class ForwardDictionaryCache<K extends DictionaryColumnUniqueIdentifier,
       DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier)
       throws CarbonUtilException {
     Dictionary forwardDictionary = null;
-    // create column dictionary info object only if dictionary and its
-    // metadata file exists for a given column identifier
-    if (!isFileExistsForGivenColumn(dictionaryColumnUniqueIdentifier)) {
-      throw new CarbonUtilException(
-          "Either dictionary or its metadata does not exist for column identifier :: "
-              + dictionaryColumnUniqueIdentifier.getColumnIdentifier());
-    }
+    // dictionary is only for primitive data type
+    assert(!dictionaryColumnUniqueIdentifier.getDataType().isComplexType());
     String columnIdentifier = dictionaryColumnUniqueIdentifier.getColumnIdentifier().getColumnId();
     ColumnDictionaryInfo columnDictionaryInfo =
         getColumnDictionaryInfo(dictionaryColumnUniqueIdentifier, columnIdentifier);

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f031394a/core/src/main/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCache.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCache.java
b/core/src/main/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCache.java
index aa05570..2a0cd38 100644
--- a/core/src/main/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCache.java
+++ b/core/src/main/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCache.java
@@ -167,13 +167,8 @@ public class ReverseDictionaryCache<K extends DictionaryColumnUniqueIdentifier,
       DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier)
       throws CarbonUtilException {
     Dictionary reverseDictionary = null;
-    // create column dictionary info object only if dictionary and its
-    // metadata file exists for a given column identifier
-    if (!isFileExistsForGivenColumn(dictionaryColumnUniqueIdentifier)) {
-      throw new CarbonUtilException(
-          "Either dictionary or its metadata does not exist for column identifier :: "
-              + dictionaryColumnUniqueIdentifier.getColumnIdentifier());
-    }
+    // dictionary is only for primitive data type
+    assert(!dictionaryColumnUniqueIdentifier.getDataType().isComplexType());
     String columnIdentifier = dictionaryColumnUniqueIdentifier.getColumnIdentifier().getColumnId();
     ColumnReverseDictionaryInfo columnReverseDictionaryInfo =
         getColumnReverseDictionaryInfo(dictionaryColumnUniqueIdentifier, columnIdentifier);

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f031394a/core/src/main/java/org/apache/carbondata/core/carbon/metadata/datatype/DataType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/metadata/datatype/DataType.java
b/core/src/main/java/org/apache/carbondata/core/carbon/metadata/datatype/DataType.java
index 88127ec..76eadff 100644
--- a/core/src/main/java/org/apache/carbondata/core/carbon/metadata/datatype/DataType.java
+++ b/core/src/main/java/org/apache/carbondata/core/carbon/metadata/datatype/DataType.java
@@ -51,4 +51,8 @@ public enum DataType {
   public String getName() {
     return name;
   }
+
+  public boolean isComplexType() {
+    return precedenceOrder >= 9 && precedenceOrder <= 11;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f031394a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
index 55601c4..3d817b6 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
@@ -35,6 +35,7 @@ import org.apache.carbondata.core.cache.CacheProvider;
 import org.apache.carbondata.core.cache.CacheType;
 import org.apache.carbondata.core.carbon.CarbonTableIdentifier;
 import org.apache.carbondata.core.carbon.ColumnIdentifier;
+import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
 import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.reader.CarbonDictionaryColumnMetaChunk;
 import org.apache.carbondata.core.util.CarbonProperties;
@@ -270,7 +271,7 @@ public class ReverseDictionaryCacheTest extends AbstractDictionaryCacheTest
{
   }
   protected DictionaryColumnUniqueIdentifier createDictionaryColumnUniqueIdentifier(
 	      String columnId) {
-	    ColumnIdentifier columnIdentifier = new ColumnIdentifier(columnId, null, null);
+	    ColumnIdentifier columnIdentifier = new ColumnIdentifier(columnId, null, DataType.DOUBLE);
 	    DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier =
 	        new DictionaryColumnUniqueIdentifier(carbonTableIdentifier, columnIdentifier);
 	    return dictionaryColumnUniqueIdentifier;

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/f031394a/core/src/test/java/org/apache/carbondata/scan/filter/FilterUtilTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/scan/filter/FilterUtilTest.java b/core/src/test/java/org/apache/carbondata/scan/filter/FilterUtilTest.java
index 23e2d10..53fdc09 100644
--- a/core/src/test/java/org/apache/carbondata/scan/filter/FilterUtilTest.java
+++ b/core/src/test/java/org/apache/carbondata/scan/filter/FilterUtilTest.java
@@ -416,21 +416,6 @@ public class FilterUtilTest extends AbstractDictionaryCacheTest {
     assertTrue(FilterUtil.prepareDefaultEndIndexKey(segmentProperties) instanceof IndexKey);
   }
 
-  @Test(expected = QueryExecutionException.class)
-  public void testGetForwardDictionaryCacheWithException() throws Exception {
-
-    AbsoluteTableIdentifier absoluteTableIdentifier =
-        new AbsoluteTableIdentifier(this.carbonStorePath, carbonTableIdentifier);
-    int ordinal = 1;
-    int keyOrdinal = 1;
-    int columnGroupOrdinal = 1;
-    int complexTypeOrdinal = 1;
-    CarbonDimension carbonDimension =
-        new CarbonDimension(columnSchema, ordinal, keyOrdinal, columnGroupOrdinal,
-            complexTypeOrdinal);
-    FilterUtil.getForwardDictionaryCache(absoluteTableIdentifier, carbonDimension);
-  }
-
   @Test public void testCheckIfRightExpressionRequireEvaluation() {
     Expression expression = new ColumnExpression("test", DataType.STRING);
     boolean result = FilterUtil.checkIfRightExpressionRequireEvaluation(expression);


Mime
View raw message