Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1835#discussion_r163775104
--- Diff:
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/datamap/CarbonDropDataMapCommand.scala
---
@@ -68,18 +69,12 @@ case class CarbonDropDataMapCommand(
lock => carbonLocks +=
CarbonLockUtil.getLockObject(tableIdentifier, lock)
}
LOGGER.audit(s"Deleting datamap [$dataMapName] under table
[$tableName]")
- var carbonTable: Option[CarbonTable] =
- catalog.getTableFromMetadataCache(dbName, tableName)
- if (carbonTable.isEmpty) {
- try {
- carbonTable =
Some(catalog.lookupRelation(identifier)(sparkSession)
- .asInstanceOf[CarbonRelation].metaData.carbonTable)
- } catch {
- case ex: NoSuchTableException =>
- if (!ifExistsSet) {
- throw ex
- }
- }
+ val carbonTable: Option[CarbonTable] = try {
+ Some(CarbonEnv.getCarbonTable(databaseNameOp,
tableName)(sparkSession))
+ } catch {
+ case ex: NoSuchTableException =>
+ if (!ifExistsSet) throw ex
--- End diff --
if add this line, when run "DROP DATAMAP IF EXISTS agg1_month ON TABLE
mainTableNotExist", it will not throw exception if the table not exists. So we
should remove it. https://github.com/apache/carbondata/pull/1858/files
---