Github user ravipesala commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2579#discussion_r206912038 --- Diff: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVAnalyzerRule.scala --- @@ -80,26 +83,54 @@ class MVAnalyzerRule(sparkSession: SparkSession) extends Rule[LogicalPlan] { } def isValidPlan(plan: LogicalPlan, catalog: SummaryDatasetCatalog): Boolean = { - !plan.isInstanceOf[Command] && !isDataMapExists(plan, catalog.listAllSchema()) && - !plan.isInstanceOf[DeserializeToObject] + if (!plan.isInstanceOf[Command] && !plan.isInstanceOf[DeserializeToObject]) { + val catalogs = extractCatalogs(plan) + !isDataMapReplaced(catalog.listAllValidSchema(), catalogs) && + isDataMapExists(catalog.listAllValidSchema(), catalogs) + } else { + false + } + } /** * Check whether datamap table already updated in the query. * - * @param plan * @param mvs --- End diff -- ok
---