Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1837#discussion_r163757369
--- Diff:
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
---
@@ -53,42 +54,50 @@ import
org.apache.carbondata.streaming.segment.StreamSegment
*/
case class CarbonAlterTableCompactionCommand(
alterTableModel: AlterTableModel,
- tableInfoOp: Option[TableInfo] = None)
- extends DataCommand {
+ tableInfoOp: Option[TableInfo] = None,
+ val operationContext: OperationContext = new OperationContext )
+ extends AtomicRunnableCommand {
+ var table: CarbonTable = _
- override def processData(sparkSession: SparkSession): Seq[Row] = {
- val LOGGER: LogService =
- LogServiceFactory.getLogService(this.getClass.getName)
+ override def processMetadata(sparkSession: SparkSession): Seq[Row] = {
+ val LOGGER: LogService =
LogServiceFactory.getLogService(this.getClass.getCanonicalName)
val tableName = alterTableModel.tableName.toLowerCase
- val databaseName =
alterTableModel.dbName.getOrElse(sparkSession.catalog.currentDatabase)
-
- val table = if (tableInfoOp.isDefined) {
- val tableInfo = tableInfoOp.get
- // To DO: CarbonEnv.updateStorePath
- CarbonTable.buildFromTableInfo(tableInfo)
+ val dbName =
alterTableModel.dbName.getOrElse(sparkSession.catalog.currentDatabase)
+ table = if (tableInfoOp.isDefined) {
+ CarbonTable.buildFromTableInfo(tableInfoOp.get)
} else {
- val relation =
- CarbonEnv.getInstance(sparkSession).carbonMetastore
- .lookupRelation(Option(databaseName), tableName)(sparkSession)
- .asInstanceOf[CarbonRelation]
+ val relation = CarbonEnv.getInstance(sparkSession).carbonMetastore
+ .lookupRelation(Option(dbName),
tableName)(sparkSession).asInstanceOf[CarbonRelation]
if (relation == null) {
- throw new NoSuchTableException(databaseName, tableName)
+ throw new NoSuchTableException(dbName, tableName)
}
if (null == relation.carbonTable) {
- LOGGER.error(s"alter table failed. table not found:
$databaseName.$tableName")
- throw new NoSuchTableException(databaseName, tableName)
+ LOGGER.error(s"Data loading failed. table not found:
$dbName.$tableName")
+ LOGGER.audit(s"Data loading failed. table not found:
$dbName.$tableName")
+ throw new NoSuchTableException(dbName, tableName)
}
relation.carbonTable
}
+ if (CarbonUtil.hasAggregationDataMap(table) ||
+ (table.isChildDataMap && null ==
operationContext.getProperty(table.getTableName))) {
--- End diff --
Irrespective of this condition I guess we always need to fire the event. If
the listener does not want to execute then move this if condition to the
listner instead of here
---