Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1861#discussion_r165300927
--- Diff:
integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/datamap/CarbonCreateDataMapCommand.scala
---
@@ -49,10 +52,22 @@ case class CarbonCreateDataMapCommand(
throw new MalformedCarbonCommandException("Streaming table does not
support creating datamap")
}
val LOGGER =
LogServiceFactory.getLogService(this.getClass.getCanonicalName)
+ val dbName = tableIdentifier.database.getOrElse("default")
+ val tableName = tableIdentifier.table + "_" + dataMapName
- if (dmClassName.equalsIgnoreCase(PREAGGREGATE.toString) ||
+ if (sparkSession.sessionState.catalog.listTables(dbName)
--- End diff --
When I change it to
"sparkSession.sessionState.catalog.tableExists(tableIdentifier)", it will fail.
like:
An exception or error caused a run to abort: Table or view
'mainTable_agg0_second' already exists in database 'default';
org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException: Table
or view 'mainTable_agg0_second' already exists in database 'default';
---