Skip to content

Commit

Permalink
Merge 4b97c01 into ca32374
Browse files Browse the repository at this point in the history
  • Loading branch information
NamanRastogi committed Dec 27, 2018
2 parents ca32374 + 4b97c01 commit 1c67d4e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Expand Up @@ -103,7 +103,7 @@ case class CarbonDropDataMapCommand(
Some(childCarbonTable.get.getDatabaseName),
childCarbonTable.get.getTableName,
dropChildTable = true)
commandToRun.processMetadata(sparkSession)
commandToRun.run(sparkSession)
}
dropDataMapFromSystemFolder(sparkSession)
return Seq.empty
Expand Down
Expand Up @@ -87,6 +87,7 @@ private[sql] case class CarbonAlterTableRenameCommand(

var timeStamp = 0L
var carbonTable: CarbonTable = null
var hiveRenameSuccess = false
// lock file path to release locks after operation
var carbonTableLockFilePath: String = null
try {
Expand Down Expand Up @@ -139,6 +140,7 @@ private[sql] case class CarbonAlterTableRenameCommand(
oldIdentifier,
newIdentifier,
oldTableIdentifier.getTablePath)
hiveRenameSuccess = true

metastore.updateTableSchemaForAlter(
newTableIdentifier,
Expand All @@ -165,15 +167,22 @@ private[sql] case class CarbonAlterTableRenameCommand(
case e: ConcurrentOperationException =>
throw e
case e: Exception =>
if (hiveRenameSuccess) {
sparkSession.sessionState.catalog.asInstanceOf[CarbonSessionCatalog].alterTableRename(
TableIdentifier(newTableName, Some(oldDatabaseName)),
TableIdentifier(oldTableName, Some(oldDatabaseName)),
carbonTable.getAbsoluteTableIdentifier.getTableName)
}
if (carbonTable != null) {
AlterTableUtil.revertRenameTableChanges(
newTableName,
carbonTable,
timeStamp)(
sparkSession)
}
LOGGER.error(opName + " operation failed: ", e)
throwMetadataException(oldDatabaseName, oldTableName,
s"Alter table rename table operation failed: ${e.getMessage}")
opName + " operation failed! Please check logs for details.")
}
Seq.empty
}
Expand Down

0 comments on commit 1c67d4e

Please sign in to comment.