Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7006E200BFF for ; Tue, 17 Jan 2017 21:08:58 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 6E564160B46; Tue, 17 Jan 2017 20:08:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B9D85160B30 for ; Tue, 17 Jan 2017 21:08:57 +0100 (CET) Received: (qmail 8496 invoked by uid 500); 17 Jan 2017 20:08:57 -0000 Mailing-List: contact commits-help@carbondata.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@carbondata.incubator.apache.org Delivered-To: mailing list commits@carbondata.incubator.apache.org Received: (qmail 8487 invoked by uid 99); 17 Jan 2017 20:08:57 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jan 2017 20:08:57 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 7E9D7C15F5 for ; Tue, 17 Jan 2017 20:08:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id c0LCJbiHjYbr for ; Tue, 17 Jan 2017 20:08:54 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 6067E5F576 for ; Tue, 17 Jan 2017 20:08:54 +0000 (UTC) Received: (qmail 7245 invoked by uid 99); 17 Jan 2017 20:08:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jan 2017 20:08:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 85F12DFADF; Tue, 17 Jan 2017 20:08:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ravipesala@apache.org To: commits@carbondata.incubator.apache.org Date: Tue, 17 Jan 2017 20:08:15 -0000 Message-Id: <066f913c24f7479fa0204d3f6b03ae9a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-carbondata git commit: if the compaction type is not minor or major need to give error message to user. archived-at: Tue, 17 Jan 2017 20:08:58 -0000 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 Authored: Tue Jan 17 14:09:25 2017 +0530 Committer: ravipesala 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 = {