akashrn5 commented on a change in pull request #3493: [CARBONDATA-3600] Fix
creating mv timeseries UDF column as partition column
URL: https://github.com/apache/carbondata/pull/3493#discussion_r355281068
##########
File path:
integration/spark2/src/main/scala/org/apache/spark/sql/CarbonEnv.scala
##########
@@ -121,11 +125,30 @@ class CarbonEnv {
CarbonProperties.getInstance
.addNonSerializableProperty(CarbonCommonConstants.IS_DRIVER_INSTANCE, "true")
initialized = true
+ cleanChildTablesNotRegisteredInHive(sparkSession)
}
}
Profiler.initialize(sparkSession.sparkContext)
LOGGER.info("Initialize CarbonEnv completed...")
}
+
+ private def cleanChildTablesNotRegisteredInHive(sparkSession: SparkSession):
Unit = {
+ val dataMapSchemas = DataMapStoreManager.getInstance().getAllDataMapSchemas
+ dataMapSchemas.asScala.foreach {
+ dataMapSchema =>
+ if (null != dataMapSchema.getRelationIdentifier &&
+ !dataMapSchema.isIndexDataMap) {
+ if (!sparkSession.sessionState
+ .catalog
+
.tableExists(TableIdentifier(dataMapSchema.getRelationIdentifier.getTableName,
+ Some(dataMapSchema.getRelationIdentifier.getDatabaseName)))) {
+
DataMapStoreManager.getInstance().dropDataMapSchema(dataMapSchema.getDataMapName)
+
DataMapStoreManager.getInstance.unRegisterDataMapCatalog(dataMapSchema)
+ FileUtils.deleteDirectory(new
File(dataMapSchema.getRelationIdentifier.getTablePath))
Review comment:
here it is better to check whether the path exists or not, instead of
directly deleting the path
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services