carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [1/2] carbondata git commit: sort_columns blocked for alter table
Date Thu, 08 Jun 2017 17:05:11 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master 40284900f -> 7dfd19352


sort_columns blocked for alter table


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

Branch: refs/heads/master
Commit: 905d31b779125ce092585a4279c905b55e0bae92
Parents: 4028490
Author: rahulforallp <rahul.kumar@knoldus.in>
Authored: Mon Jun 5 15:39:48 2017 +0530
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Thu Jun 8 22:34:20 2017 +0530

----------------------------------------------------------------------
 .../spark/sql/parser/CarbonSpark2SqlParser.scala     |  3 ++-
 .../vectorreader/AddColumnTestCases.scala            | 15 +++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/905d31b7/integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
index bff1af3..a14f33e 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/parser/CarbonSpark2SqlParser.scala
@@ -315,7 +315,8 @@ class CarbonSpark2SqlParser extends CarbonDDLSqlParser {
           val tblProps = tblProp.get
             .map(f => if (CarbonCommonConstants.TABLE_BLOCKSIZE.equalsIgnoreCase(f._1)
||
                           CarbonCommonConstants.NO_INVERTED_INDEX.equalsIgnoreCase(f._1)
||
-                          CarbonCommonConstants.COLUMN_GROUPS.equalsIgnoreCase(f._1)) {
+                          CarbonCommonConstants.COLUMN_GROUPS.equalsIgnoreCase(f._1) ||
+            CarbonCommonConstants.SORT_COLUMNS.equalsIgnoreCase(f._1)) {
               throw new MalformedCarbonCommandException(
                 s"Unsupported Table property in add column: ${ f._1 }")
             } else if (f._1.toLowerCase.startsWith("default.value.")) {

http://git-wip-us.apache.org/repos/asf/carbondata/blob/905d31b7/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/vectorreader/AddColumnTestCases.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/vectorreader/AddColumnTestCases.scala
b/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/vectorreader/AddColumnTestCases.scala
index 52abbe8..be29c1e 100644
--- a/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/vectorreader/AddColumnTestCases.scala
+++ b/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/vectorreader/AddColumnTestCases.scala
@@ -24,6 +24,8 @@ import org.apache.spark.sql.Row
 import org.apache.spark.sql.common.util.QueryTest
 import org.scalatest.BeforeAndAfterAll
 
+import org.apache.carbondata.spark.exception.MalformedCarbonCommandException
+
 class AddColumnTestCases extends QueryTest with BeforeAndAfterAll {
 
   override def beforeAll {
@@ -344,6 +346,18 @@ class AddColumnTestCases extends QueryTest with BeforeAndAfterAll {
     sql("DROP TABLE IF EXISTS alter_dict")
   }
 
+  test("test sort_columns for add columns") {
+    sql("DROP TABLE IF EXISTS alter_sort_columns")
+    sql(
+      "CREATE TABLE alter_sort_columns(stringField string,charField string) STORED BY 'carbondata'")
+    val caught = intercept[MalformedCarbonCommandException] {
+      sql(
+        "Alter table alter_sort_columns add columns(newField Int) tblproperties" +
+        "('sort_columns'='newField')")
+    }
+    assert(caught.getMessage.equals("Unsupported Table property in add column: sort_columns"))
+  }
+
   test("test compaction with all no dictionary columns") {
     sql("DROP TABLE IF EXISTS alter_no_dict")
     sql("CREATE TABLE alter_no_dict(stringField string,charField string) STORED BY 'carbondata'
TBLPROPERTIES('DICTIONARY_EXCLUDE'='stringField,charField')")
@@ -360,6 +374,7 @@ class AddColumnTestCases extends QueryTest with BeforeAndAfterAll {
   override def afterAll {
     sql("DROP TABLE IF EXISTS addcolumntest")
     sql("drop table if exists hivetable")
+    sql("drop table if exists alter_sort_columns")
     sqlContext.setConf("carbon.enable.vector.reader", "false")
   }
 }


Mime
View raw message