measure can not use columnDict

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

Branch: refs/heads/branch-0.1
Commit: 16533279bc45cb8eae22a9cccf891715d8c1bec9
Parents: 8f8933e
Author: Jay357089 <liujunj...@huawei.com>
Authored: Wed Aug 24 10:08:01 2016 +0800
Committer: ravipesala <ravi.pes...@gmail.com>
Committed: Thu Sep 22 10:28:43 2016 +0530

----------------------------------------------------------------------
 .../spark/util/GlobalDictionaryUtil.scala          |  7 ++++---
 .../util/ExternalColumnDictionaryTestCase.scala    | 17 +++++++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/16533279/integration/spark/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala
----------------------------------------------------------------------
diff --git 
a/integration/spark/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala
 
b/integration/spark/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala
index 7e60320..cabedfd 100644
--- 
a/integration/spark/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala
+++ 
b/integration/spark/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala
@@ -499,9 +499,10 @@ object GlobalDictionaryUtil extends Logging {
     val preDictDimensionOption = dimensions.filter(
       _.getColName.equalsIgnoreCase(dimParent))
     if (preDictDimensionOption.length == 0) {
-      logError(s"No column $dimParent exists in 
${table.getDatabaseName}.${table.getTableName}")
-      throw new DataLoadingException(s"No column $colName exists " +
-      s"in ${table.getDatabaseName}.${table.getTableName}")
+      logError(s"Column $dimParent is not a key column " +
+        s"in ${table.getDatabaseName}.${table.getTableName}")
+      throw new DataLoadingException(s"Column $dimParent is not a key column. 
" +
+        s"Only key column can be part of dictionary and used in COLUMNDICT 
option.")
     }
     val preDictDimension = preDictDimensionOption(0)
     if (preDictDimension.isComplex) {

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/16533279/integration/spark/src/test/scala/org/apache/carbondata/spark/util/ExternalColumnDictionaryTestCase.scala
----------------------------------------------------------------------
diff --git 
a/integration/spark/src/test/scala/org/apache/carbondata/spark/util/ExternalColumnDictionaryTestCase.scala
 
b/integration/spark/src/test/scala/org/apache/carbondata/spark/util/ExternalColumnDictionaryTestCase.scala
index 4e013bb..44ca85e 100644
--- 
a/integration/spark/src/test/scala/org/apache/carbondata/spark/util/ExternalColumnDictionaryTestCase.scala
+++ 
b/integration/spark/src/test/scala/org/apache/carbondata/spark/util/ExternalColumnDictionaryTestCase.scala
@@ -21,6 +21,7 @@ package org.apache.carbondata.spark.util
 import java.io.File
 
 import org.apache.carbondata.core.carbon.CarbonDataLoadSchema
+import org.apache.carbondata.processing.etl.DataLoadingException
 import org.apache.carbondata.spark.exception.MalformedCarbonCommandException
 import org.apache.carbondata.spark.load.CarbonLoadModel
 import org.apache.spark.sql.{CarbonEnv, CarbonRelation}
@@ -217,6 +218,22 @@ class ExternalColumnDictionaryTestCase extends QueryTest 
with BeforeAndAfterAll
       case ex: MalformedCarbonCommandException =>
         assertResult(ex.getMessage)("Error: COLUMNDICT and ALL_DICTIONARY_PATH 
can not be used together " +
           "in options")
+      case _ => assert(false)
+    }
+  }
+
+  test("Measure can not use COLUMNDICT") {
+    try {
+      sql(s"""
+      LOAD DATA LOCAL INPATH "$complexFilePath1" INTO TABLE loadSqlTest
+      OPTIONS('COLUMNDICT'='gamePointId:$filePath')
+      """)
+      assert(false)
+    } catch {
+      case ex: DataLoadingException =>
+        assertResult(ex.getMessage)("Column gamePointId is not a key column. 
Only key column can be part " +
+          "of dictionary and used in COLUMNDICT option.")
+      case _ => assert(false)
     }
   }
 

Reply via email to