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

 ##########
 File path: 
core/src/main/java/org/apache/carbondata/core/datamap/DataMapUtil.java
 ##########
 @@ -91,43 +94,129 @@ public static DataMapJob getDataMapJob(Configuration 
configuration) throws IOExc
    * @param carbonTable
    * @throws IOException
    */
-  public static void executeDataMapJobForClearingDataMaps(CarbonTable 
carbonTable)
-      throws IOException {
-    String dataMapJobClassName = 
"org.apache.carbondata.spark.rdd.SparkDataMapJob";
+  private static void executeDataMapJobForClearingSegmentDataMaps(DataMapJob 
dataMapJob,
+      CarbonTable carbonTable) throws IOException {
+    SegmentStatusManager.ValidAndInvalidSegmentsInfo 
validAndInvalidSegmentsInfo =
+            getValidAndInvalidSegments(carbonTable, 
FileFactory.getConfiguration());
+    List<String> invalidSegment = new ArrayList<>();
+    for (Segment segment : validAndInvalidSegmentsInfo.getInvalidSegments()) {
+      invalidSegment.add(segment.getSegmentNo());
+    }
+    DistributableDataMapFormat dataMapFormat = new 
DistributableDataMapFormat(carbonTable, null,
+        validAndInvalidSegmentsInfo.getValidSegments(), invalidSegment, null, 
true,
+        DataMapLevel.FG);
+    dataMapJob.execute(dataMapFormat);
+  }
+
+  public static void clearEmbeddedDataMaps(CarbonTable carbonTable) throws 
IOException {
+    String dataMapJobClassName = 
"org.apache.carbondata.indexserver.EmbeddedDataMapJob";
     DataMapJob dataMapJob = (DataMapJob) createDataMapJob(dataMapJobClassName);
     if (dataMapJob == null) {
       return;
     }
-    String className = 
"org.apache.carbondata.core.datamap.DistributableDataMapFormat";
-    SegmentStatusManager.ValidAndInvalidSegmentsInfo 
validAndInvalidSegmentsInfo =
-        getValidAndInvalidSegments(carbonTable, 
FileFactory.getConfiguration());
-    List<Segment> validSegments = 
validAndInvalidSegmentsInfo.getValidSegments();
-    List<Segment> invalidSegments = 
validAndInvalidSegmentsInfo.getInvalidSegments();
-    DataMapExprWrapper dataMapExprWrapper = null;
-    if (DataMapStoreManager.getInstance().getAllDataMap(carbonTable).size() > 
0) {
-      DataMapChooser dataMapChooser = new DataMapChooser(carbonTable);
-      dataMapExprWrapper = dataMapChooser.getAllDataMapsForClear(carbonTable);
-    } else {
+    executeDataMapJobForClearingSegmentDataMaps(dataMapJob, carbonTable);
+  }
+
+  public static void clearDistributedDataMaps(CarbonTable carbonTable)
+      throws IOException {
+    String dataMapJobClassName = 
"org.apache.carbondata.indexserver.DistributedClearCacheJob";
 
 Review comment:
   DistributedClearCacheJob is in spark2 module. cannot access the class from 
here(core)

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to