Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1377#discussion_r141528239
--- Diff:
core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataMapFactory.java
---
@@ -120,15 +121,17 @@ public void clear(String segmentId) {
if (blockIndexes != null) {
for (TableBlockIndexUniqueIdentifier blockIndex : blockIndexes) {
DataMap dataMap = cache.getIfPresent(blockIndex);
- dataMap.clear();
- cache.invalidate(blockIndex);
+ if (dataMap != null) {
+ cache.invalidate(blockIndex);
+ dataMap.clear();
+ }
}
}
}
@Override
public void clear() {
- for (String segmentId: segmentMap.keySet()) {
+ for (String segmentId: segmentMap.keySet().toArray(new
String[segmentMap.size()])) {
--- End diff --
It is needed as we cannot we cannot iterate on set and remove an entry at
the same time. So here it is converted to array so that we can remove an entry
from map in clear method
---