carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [1/2] incubator-carbondata git commit: if the compaction type is not minor or major need to give error message to user.
Date Tue, 17 Jan 2017 20:08:15 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master 33c9a8165 -> 3a596f611


if the compaction type is not minor or major need to give error message to user.


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

Branch: refs/heads/master
Commit: 9f99dfb15e377dcbb1fa5eacb26975365c38ac27
Parents: 33c9a81
Author: ravikiran <ravikiran.sn042@gmail.com>
Authored: Tue Jan 17 14:09:25 2017 +0530
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Wed Jan 18 01:37:15 2017 +0530

----------------------------------------------------------------------
 .../core/constants/CarbonCommonConstants.java   |  4 ++++
 .../org/apache/spark/util/Compaction.scala      | 22 ++++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/9f99dfb1/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
b/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
index e208962..6a30bd4 100644
--- a/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
+++ b/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
@@ -1123,6 +1123,10 @@ public final class CarbonCommonConstants {
    */
   public static final String USE_PREFETCH_WHILE_LOADING_DEFAULT = "false";
 
+  public static final String MINOR = "minor";
+
+  public static final String MAJOR = "major";
+
   private CarbonCommonConstants() {
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/9f99dfb1/integration/spark2/src/main/scala/org/apache/spark/util/Compaction.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/util/Compaction.scala b/integration/spark2/src/main/scala/org/apache/spark/util/Compaction.scala
index 3b45ec0..6ca8449 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/util/Compaction.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/util/Compaction.scala
@@ -19,6 +19,9 @@ package org.apache.spark.util
 import org.apache.spark.sql.{CarbonEnv, SparkSession}
 import org.apache.spark.sql.execution.command.{AlterTableCompaction, AlterTableModel}
 
+import org.apache.carbondata.core.constants.CarbonCommonConstants
+import org.apache.carbondata.spark.merger.CompactionType
+
 /**
  * table compaction api
  */
@@ -28,12 +31,19 @@ object Compaction {
   def compaction(spark: SparkSession, dbName: String, tableName: String,
       compactionType: String): Unit = {
     TableAPIUtil.validateTableExists(spark, dbName, tableName)
-    AlterTableCompaction(AlterTableModel(Some(dbName),
-      tableName,
-      None,
-      compactionType,
-      Some(System.currentTimeMillis()),
-      "")).run(spark)
+    if (compactionType.equalsIgnoreCase(CarbonCommonConstants.MAJOR) ||
+        compactionType.equalsIgnoreCase(CarbonCommonConstants.MINOR)) {
+      AlterTableCompaction(AlterTableModel(Some(dbName),
+        tableName,
+        None,
+        compactionType,
+        Some(System.currentTimeMillis()),
+        "")).run(spark)
+    }
+    else {
+      sys.error("Compaction type is wrong. Please select minor or major.")
+    }
+
   }
 
   def main(args: Array[String]): Unit = {


Mime
View raw message