Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2310#discussion_r188846192
--- Diff:
core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java
---
@@ -364,17 +368,54 @@ public void clearInvalidSegments(CarbonTable
carbonTable, List<Segment> segments
* @param identifier Table identifier
*/
public void clearDataMaps(AbsoluteTableIdentifier identifier) {
+ CarbonTable carbonTable = getCarbonTable(identifier);
String tableUniqueName =
identifier.getCarbonTableIdentifier().getTableUniqueName();
List<TableDataMap> tableIndices = allDataMaps.get(tableUniqueName);
+ if (null != carbonTable && tableIndices != null) {
+ try {
+ DataMapUtil.executeDataMapJobForClearingDataMaps(carbonTable);
+ } catch (IOException e) {
+ LOGGER.error(e, "clear dataMap job failed");
+ // ignoring the exception
+ }
+ }
segmentRefreshMap.remove(identifier.uniqueName());
+ clearDataMaps(tableUniqueName);
+ allDataMaps.remove(tableUniqueName);
+ }
+
+ /**
+ * This method returns the carbonTable from identifier
+ * @param identifier
+ * @return
+ */
+ public CarbonTable getCarbonTable(AbsoluteTableIdentifier identifier) {
+ CarbonTable carbonTable = null;
+ try {
+ carbonTable = CarbonTable
--- End diff --
First try getting the table from cache using
`CarbonMetadata.getInstance.getCarbonTable(dbName, tableName)` , if cannot get
then read from disk
---