Github user jackylk commented on a diff in the pull request: https://github.com/apache/carbondata/pull/1192#discussion_r131634496 --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala --- @@ -183,6 +190,138 @@ case class AlterTableCompaction(alterTableModel: AlterTableModel) extends Runnab } } +/** + * Command for Alter Table Add & Split partition + * Add is a special case of Splitting the default partition (part0) + * @param alterTableSplitPartitionModel + */ +case class AlterTableSplitPartition(alterTableSplitPartitionModel: AlterTableSplitPartitionModel) + extends RunnableCommand with DataProcessCommand with SchemaProcessCommand { + val LOGGER = LogServiceFactory.getLogService(this.getClass.getName) + val tableName = alterTableSplitPartitionModel.tableName + val splitInfo = alterTableSplitPartitionModel.splitInfo + val partitionId = alterTableSplitPartitionModel.partitionId.toInt + var partitionInfo: PartitionInfo = null + var carbonMetaStore: CarbonMetaStore = null + var relation: CarbonRelation = null + var dbName: String = null + var storePath: String = null + var carbonTableIdentifier: CarbonTableIdentifier = null + val timestampFormatter = new SimpleDateFormat(CarbonProperties.getInstance + .getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, + CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)) + val dateFormatter = new SimpleDateFormat(CarbonProperties.getInstance + .getProperty(CarbonCommonConstants.CARBON_DATE_FORMAT, + CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT)) + val locksToBeAcquired = List(LockUsage.METADATA_LOCK, + LockUsage.COMPACTION_LOCK, + LockUsage.DELETE_SEGMENT_LOCK, + LockUsage.DROP_TABLE_LOCK, + LockUsage.CLEAN_FILES_LOCK, + LockUsage.ALTER_PARTITION_LOCK) + + def run(sparkSession: SparkSession): Seq[Row] = { + var success = false + try { + processData(sparkSession) + success = true + } catch { + case e: Exception => sys.error(s"Error in alter table split partition : ${ e.getMessage }") + success = false + } + if (success) { + processSchema(sparkSession) --- End diff -- processSchema first then processData
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---