[GitHub] qiuchenjian commented on a change in pull request #3094: [CARBONDATA-3264] Added SORT_SCOPE in ALTER TABLE SET

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] qiuchenjian commented on a change in pull request #3094: [CARBONDATA-3264] Added SORT_SCOPE in ALTER TABLE SET

GitBox
qiuchenjian commented on a change in pull request #3094: [CARBONDATA-3264] Added SORT_SCOPE in ALTER TABLE SET
URL: https://github.com/apache/carbondata/pull/3094#discussion_r249681323
 
 

 ##########
 File path: integration/spark-common-cluster-test/src/test/scala/org/apache/carbondata/cluster/sdv/generated/AlterTableTestCase.scala
 ##########
 @@ -1016,6 +1016,62 @@ class AlterTableTestCase extends QueryTest with BeforeAndAfterAll {
     }
   }
 
+
+  test("AlterTable Change Sort Scope 1") {
+    sql("DROP TABLE IF EXISTS t1")
+    sql(s"CREATE TABLE t1(age int, name string) STORED BY 'carbondata' TBLPROPERTIES" +
+        s"('sort_scope'='local_sort', 'sort_columns'='age')")
+    sql("ALTER TABLE t1 SET TBLPROPERTIES('sort_scope'='batch_sort')")
+
+    var sort_scope: String = ""
+    sql("DESCRIBE FORMATTED t1").collect().foreach(row => {
+      if (row.getAs[String]("col_name").equalsIgnoreCase("sort scope")) {
+        sort_scope = row.getAs[String]("data_type")
+      }
+    })
+    assert(sort_scope.equalsIgnoreCase("batch_sort"))
+    sql("DROP TABLE t1")
+  }
+
+  test("AlterTable Change Sort Scope 2") {
+    sql("DROP TABLE IF EXISTS t1")
+    sql(s"CREATE TABLE t1(age int, name string) STORED BY 'carbondata' TBLPROPERTIES" +
+        s"('sort_columns'='')")
+    sql("ALTER TABLE t1 SET TBLPROPERTIES('sort_scope'='local_sort')")
 
 Review comment:
   Can we response a new exception of "set sort scope error" when sort_columns is empty
   it's more meaningful and warn user

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services