Skip to content

Commit

Permalink
[CARBONDATA-3398]Block show/drop metacache directly on child table
Browse files Browse the repository at this point in the history
  • Loading branch information
Indhumathi27 committed Jun 21, 2019
1 parent 2fb9234 commit 824478e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Expand Up @@ -520,5 +520,20 @@ class TestAllOperationsOnMV extends QueryTest with BeforeAndAfterEach {
sql("drop table IF EXISTS maintable")
}

test("test drop/show meta cache directly on mv datamap table") {
sql("drop table IF EXISTS maintable")
sql("create table maintable(name string, c_code int, price int) stored by 'carbondata'")
sql("insert into table maintable select 'abc',21,2000")
sql("drop datamap if exists dm ")
sql("create datamap dm using 'mv' as select name, sum(price) from maintable group by name")
sql("select name, sum(price) from maintable group by name").collect()
intercept[UnsupportedOperationException] {
sql("show metacache on table dm_table").show(false)
}.getMessage.contains("Operation not allowed on child table.")
intercept[UnsupportedOperationException] {
sql("drop metacache on table dm_table").show(false)
}.getMessage.contains("Operation not allowed on child table.")
}

}

Expand Up @@ -49,7 +49,7 @@ object DropCachePreAggEventListener extends OperationEventListener {
val carbonTable = dropCacheEvent.carbonTable
val sparkSession = dropCacheEvent.sparkSession
val internalCall = dropCacheEvent.internalCall
if (carbonTable.isChildDataMap && !internalCall) {
if ((carbonTable.isChildDataMap || carbonTable.isChildTable) && !internalCall) {
throw new UnsupportedOperationException("Operation not allowed on child table.")
}

Expand Down
Expand Up @@ -52,7 +52,7 @@ object ShowCachePreAggEventListener extends OperationEventListener {
val carbonTable = showTableCacheEvent.carbonTable
val sparkSession = showTableCacheEvent.sparkSession
val internalCall = showTableCacheEvent.internalCall
if (carbonTable.isChildDataMap && !internalCall) {
if ((carbonTable.isChildDataMap || carbonTable.isChildTable) && !internalCall) {
throw new UnsupportedOperationException("Operation not allowed on child table.")
}

Expand Down

0 comments on commit 824478e

Please sign in to comment.