Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CARBONDATA-3398]Block show/drop metacache directly on child table #3302

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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