This is an automated email from the ASF dual-hosted git repository.

akashrn5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/carbondata.git


The following commit(s) were added to refs/heads/master by this push:
     new eac9dbb  [CARBONDATA-3529]Block Add Partition directly on MV datamap 
table
eac9dbb is described below

commit eac9dbbfee353e065c4e59ca626bb137818e5195
Author: Indhumathi27 <[email protected]>
AuthorDate: Fri Sep 27 16:41:19 2019 +0530

    [CARBONDATA-3529]Block Add Partition directly on MV datamap table
    
    Problem:
    Add Partition directly on mv datamap table is not blocked
    
    Solution:
    Blocked Add Partition directly on MV datamap partitioned table
    
    This closes #3402
---
 .../org/apache/carbondata/mv/rewrite/TestPartitionWithMV.scala     | 7 +++++++
 .../partition/CarbonAlterTableAddHivePartitionCommand.scala        | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/datamap/mv/core/src/test/scala/org/apache/carbondata/mv/rewrite/TestPartitionWithMV.scala
 
b/datamap/mv/core/src/test/scala/org/apache/carbondata/mv/rewrite/TestPartitionWithMV.scala
index 6245dae..3cb0227 100644
--- 
a/datamap/mv/core/src/test/scala/org/apache/carbondata/mv/rewrite/TestPartitionWithMV.scala
+++ 
b/datamap/mv/core/src/test/scala/org/apache/carbondata/mv/rewrite/TestPartitionWithMV.scala
@@ -502,6 +502,13 @@ class TestPartitionWithMV extends QueryTest with 
BeforeAndAfterAll {
     assert(intercept[Exception] {
       sql("alter table p1_table add partition(c=1)")
     }.getMessage.equals("Cannot add partition directly on non partitioned 
table"))
+    sql("drop datamap if exists p1")
+    sql(
+      "create datamap p1 on table partitionone using 'mv' as select empname, 
year from " +
+      "partitionone")
+    assert(intercept[Exception] {
+      sql("alter table p1_table add partition(partitionone_year=1)")
+    }.getMessage.equals("Cannot add partition directly on child tables"))
   }
 
   test("test if alter rename is blocked on partition table with mv") {
diff --git 
a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/partition/CarbonAlterTableAddHivePartitionCommand.scala
 
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/partition/CarbonAlterTableAddHivePartitionCommand.scala
index dcaac98..a7bf5f4 100644
--- 
a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/partition/CarbonAlterTableAddHivePartitionCommand.scala
+++ 
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/partition/CarbonAlterTableAddHivePartitionCommand.scala
@@ -58,8 +58,8 @@ case class CarbonAlterTableAddHivePartitionCommand(
     setAuditTable(table)
     setAuditInfo(Map("partition" -> partitionSpecsAndLocs.mkString(", ")))
     if (table.isHivePartitionTable) {
-      if (table.isChildDataMap) {
-        throw new UnsupportedOperationException("Cannot add partition directly 
on aggregate tables")
+      if (table.isChildDataMap || table.isChildTable) {
+        throw new UnsupportedOperationException("Cannot add partition directly 
on child tables")
       }
       val partitionWithLoc = partitionSpecsAndLocs.filter(_._2.isDefined)
       if (partitionWithLoc.nonEmpty) {

Reply via email to