[GitHub] [carbondata] ravipesala commented on a change in pull request #3177: [CARBONDATA-3337][CARBONDATA-3306] Distributed index server

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] ravipesala commented on a change in pull request #3177: [CARBONDATA-3337][CARBONDATA-3306] Distributed index server

GitBox
ravipesala commented on a change in pull request #3177: [CARBONDATA-3337][CARBONDATA-3306] Distributed index server
URL: https://github.com/apache/carbondata/pull/3177#discussion_r279627134
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/datamap/DistributableDataMapFormat.java
 ##########
 @@ -85,33 +143,67 @@
       private ExtendedBlocklet currBlocklet;
       private List<DataMap> dataMaps;
 
-      @Override public void initialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext)
+      @Override
+      public void initialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext)
           throws IOException, InterruptedException {
-        distributable = (DataMapDistributableWrapper) inputSplit;
-        // clear the segmentMap and from cache in executor when there are invalid segments
-        if (invalidSegments.size() > 0) {
-          DataMapStoreManager.getInstance().clearInvalidSegments(table, invalidSegments);
-        }
-        TableDataMap tableDataMap = DataMapStoreManager.getInstance()
-            .getDataMap(table, distributable.getDistributable().getDataMapSchema());
+        DataMapDistributableWrapper distributable = (DataMapDistributableWrapper) inputSplit;
+        distributable.getDistributable().getSegment().setCacheable(!isFallbackJob);
+        distributable.getDistributable().getSegment().setReadCommittedScope(readCommittedScope);
+        List<Segment> segmentsToLoad = new ArrayList<>();
+        segmentsToLoad.add(distributable.getDistributable().getSegment());
         if (isJobToClearDataMaps) {
-          // if job is to clear datamaps just clear datamaps from cache and return
-          DataMapStoreManager.getInstance()
-              .clearDataMaps(table.getCarbonTableIdentifier().getTableUniqueName());
-          // clear the segment properties cache from executor
-          SegmentPropertiesAndSchemaHolder.getInstance()
-              .invalidate(table.getAbsoluteTableIdentifier());
-          blockletIterator = Collections.emptyIterator();
+          if (StringUtils.isNotEmpty(dataMapToClear)) {
+            List<TableDataMap> dataMaps =
+                DataMapStoreManager.getInstance().getAllVisibleDataMap(table);
+            List<TableDataMap> dataMapsTobeRemoved = new ArrayList<>();
+            for (TableDataMap tableDataMap : dataMaps) {
+              if (tableDataMap != null && dataMapToClear
+                  .equalsIgnoreCase(tableDataMap.getDataMapSchema().getDataMapName())) {
+                tableDataMap.deleteSegmentDatamapData(
+                    ((DataMapDistributableWrapper) inputSplit).getDistributable().getSegment()
+                        .getSegmentNo());
+                dataMapsTobeRemoved.add(tableDataMap);
+              }
+            }
+            dataMaps.removeAll(dataMapsTobeRemoved);
 
 Review comment:
   This remove will not work as tableDatamap does not override equals properly. Please handle it.

----------------------------------------------------------------
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:
[hidden email]


With regards,
Apache Git Services