carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manishgupt...@apache.org
Subject carbondata git commit: [CARBONDATA-1894] Add compactionType Parameter to compaction event
Date Thu, 14 Dec 2017 09:21:36 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master d504e067d -> 714d05c12


[CARBONDATA-1894] Add compactionType Parameter to compaction event

Based on compaction type the operations can be changed. Therefore adding the compaction type
parameter to compaction event

This closes #1655


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

Branch: refs/heads/master
Commit: 714d05c124f89235a326aed85b7d0e37fb70ab5e
Parents: d504e06
Author: dhatchayani <dhatcha.official@gmail.com>
Authored: Wed Dec 13 19:11:16 2017 +0530
Committer: manishgupta88 <tomanishgupta18@gmail.com>
Committed: Thu Dec 14 14:54:34 2017 +0530

----------------------------------------------------------------------
 .../CarbonAlterTableCompactionCommand.scala     | 26 +++++++++++++++-----
 1 file changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/714d05c1/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
index 55eb5c3..930dd57 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
@@ -21,7 +21,7 @@ import scala.collection.JavaConverters._
 
 import org.apache.spark.sql.{CarbonEnv, Row, SparkSession, SQLContext}
 import org.apache.spark.sql.catalyst.analysis.NoSuchTableException
-import org.apache.spark.sql.execution.command.{AlterTableModel, CompactionModel, DataCommand}
+import org.apache.spark.sql.execution.command.{AlterTableModel, CarbonMergerMapping, CompactionModel,
DataCommand}
 import org.apache.spark.sql.hive.CarbonRelation
 import org.apache.spark.sql.util.CarbonException
 
@@ -31,7 +31,7 @@ import org.apache.carbondata.core.locks.{CarbonLockFactory, LockUsage}
 import org.apache.carbondata.core.metadata.schema.table.{CarbonTable, TableInfo}
 import org.apache.carbondata.core.mutate.CarbonUpdateUtil
 import org.apache.carbondata.core.util.CarbonProperties
-import org.apache.carbondata.events.{AlterTableCompactionPostEvent, AlterTableCompactionPreEvent,
OperationContext, OperationListenerBus}
+import org.apache.carbondata.events.{AlterTableCompactionPostEvent, AlterTableCompactionPreEvent,
AlterTableCompactionPreStatusUpdateEvent, OperationContext, OperationListenerBus}
 import org.apache.carbondata.processing.loading.model.{CarbonDataLoadSchema, CarbonLoadModel}
 import org.apache.carbondata.processing.merger.{CarbonDataMergerUtil, CompactionType}
 import org.apache.carbondata.spark.rdd.CarbonDataRDDFactory
@@ -200,15 +200,29 @@ case class CarbonAlterTableCompactionCommand(
               carbonLoadModel.getTablePath,
               carbonTable, true)
 
+            val carbonMergerMapping = CarbonMergerMapping(carbonTable.getTablePath,
+              carbonTable.getMetaDataFilepath,
+              "",
+              carbonTable.getDatabaseName,
+              carbonTable.getTableName,
+              Array(),
+              carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier.getTableId,
+              compactionType,
+              maxSegmentColCardinality = null,
+              maxSegmentColumnSchemaList = null
+            )
+
             // trigger event for merge index
             val operationContext = new OperationContext
-            val alterTableCompactionPreEvent: AlterTableCompactionPreEvent =
-              AlterTableCompactionPreEvent(sqlContext.sparkSession,
+            // trigger event for compaction
+            val alterTableCompactionPreStatusUpdateEvent: AlterTableCompactionPreStatusUpdateEvent
=
+              AlterTableCompactionPreStatusUpdateEvent(sqlContext.sparkSession,
                 carbonTable,
-                null,
+                carbonMergerMapping,
+                carbonLoadModel,
                 "")
             OperationListenerBus.getInstance
-              .fireEvent(alterTableCompactionPreEvent, operationContext)
+              .fireEvent(alterTableCompactionPreStatusUpdateEvent, operationContext)
 
           } else {
             CarbonDataRDDFactory.startCompactionThreads(


Mime
View raw message