Indhumathi27 commented on a change in pull request #3184: [CARBONDATA-3357] 
Support TableProperties from single parent table and restrict 
alter/delete/partition on mv
URL: https://github.com/apache/carbondata/pull/3184#discussion_r282591445
 
 

 ##########
 File path: 
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/mv/DataMapListeners.scala
 ##########
 @@ -139,3 +148,130 @@ object LoadPostDataMapListener extends 
OperationEventListener {
     }
   }
 }
+
+/**
+ * Listeners to block operations like delete segment on id or by date on tables
+ * having an mv datamap or on mv datamap tables
+ */
+object DataMapDeleteSegmentPreListener extends OperationEventListener {
+  /**
+   * Called on a specified event occurrence
+   *
+   * @param event
+   * @param operationContext
+   */
+  override def onEvent(event: Event, operationContext: OperationContext): Unit 
= {
+    val carbonTable = event match {
+      case e: DeleteSegmentByIdPreEvent =>
+        e.asInstanceOf[DeleteSegmentByIdPreEvent].carbonTable
+      case e: DeleteSegmentByDatePreEvent =>
+        e.asInstanceOf[DeleteSegmentByDatePreEvent].carbonTable
+    }
+    if (null != carbonTable) {
+      if (CarbonTable.hasMVDataMap(carbonTable)) {
 
 Review comment:
   Moved to 
integration/spark2/src/main/scala/org/apache/spark/util/DataMapUtil.scala

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


With regards,
Apache Git Services

Reply via email to