You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ja...@apache.org on 2017/12/24 13:26:35 UTC

[39/50] [abbrv] carbondata git commit: [CARBONDATA-1592] Added event exceptions

[CARBONDATA-1592] Added event exceptions

This closes #1705


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/dfe3097d
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/dfe3097d
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/dfe3097d

Branch: refs/heads/fgdatamap
Commit: dfe3097d3d507833348806fccf55f5467f916bab
Parents: fc93de1
Author: Manohar <ma...@gmail.com>
Authored: Thu Dec 21 16:42:40 2017 +0530
Committer: ravipesala <ra...@gmail.com>
Committed: Fri Dec 22 10:12:15 2017 +0530

----------------------------------------------------------------------
 .../events/exception/EventExceptions.scala      | 32 ++++++++++++++++++++
 .../management/CarbonLoadDataCommand.scala      |  4 +++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/dfe3097d/integration/spark-common/src/main/scala/org/apache/carbondata/events/exception/EventExceptions.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common/src/main/scala/org/apache/carbondata/events/exception/EventExceptions.scala b/integration/spark-common/src/main/scala/org/apache/carbondata/events/exception/EventExceptions.scala
new file mode 100644
index 0000000..4faef6f
--- /dev/null
+++ b/integration/spark-common/src/main/scala/org/apache/carbondata/events/exception/EventExceptions.scala
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.events.exception
+
+/**
+ * for handling pre event specific exceptions
+ *
+ * @param message
+ */
+case class PreEventException(message: String, isCleanupRequired: Boolean) extends Exception(message)
+
+/**
+ * for handling post event specific exceptions
+ *
+ * @param message
+ */
+case class PostEventException(message: String) extends Exception(message)

http://git-wip-us.apache.org/repos/asf/carbondata/blob/dfe3097d/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonLoadDataCommand.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonLoadDataCommand.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonLoadDataCommand.scala
index 7285d9d..5eee0bf 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonLoadDataCommand.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonLoadDataCommand.scala
@@ -62,6 +62,7 @@ import org.apache.carbondata.core.statusmanager.{SegmentStatus, SegmentStatusMan
 import org.apache.carbondata.core.util.{CarbonProperties, CarbonUtil}
 import org.apache.carbondata.core.util.path.CarbonStorePath
 import org.apache.carbondata.events.{LoadTablePostExecutionEvent, LoadTablePreExecutionEvent, OperationContext, OperationListenerBus}
+import org.apache.carbondata.events.exception.PreEventException
 import org.apache.carbondata.format
 import org.apache.carbondata.processing.exception.DataLoadingException
 import org.apache.carbondata.processing.loading.TableProcessingOperations
@@ -238,6 +239,9 @@ case class CarbonLoadDataCommand(
           CarbonLoaderUtil.updateTableStatusForFailure(carbonLoadModel)
           LOGGER.error(ex, s"Dataload failure for $dbName.$tableName")
           throw new RuntimeException(s"Dataload failure for $dbName.$tableName, ${ex.getMessage}")
+        // In case of event related exception
+        case preEventEx: PreEventException =>
+          throw new AnalysisException(preEventEx.getMessage)
         case ex: Exception =>
           LOGGER.error(ex)
           // update the load entry in table status file for changing the status to marked for delete