ravipesala 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_r282552675
##########
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)) {
+ throw new UnsupportedOperationException(
+ "Delete segment operation is not supported on tables which have mv datamap")
Review comment:
Don't put mv name here, just check for child tables and throw exception.
----------------------------------------------------------------
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:
[hidden email]
With regards,
Apache Git Services