[GitHub] [carbondata] kunal642 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] kunal642 commented on a change in pull request #3177: [CARBONDATA-3337][CARBONDATA-3306] Distributed index server

GitBox
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_r277966514
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/datamap/DistributableDataMapFormat.java
 ##########
 @@ -87,37 +122,52 @@
 
       @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());
+        ExplainCollector.addPruningInfo(table.getTableName());
+        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();
+          List<ExtendedBlocklet> list = new ArrayList<ExtendedBlocklet>();
+          list.add(new ExtendedBlocklet());
+          blockletIterator = list.iterator();
           return;
+        } else if (invalidSegments.size() > 0) {
+          // clear the segmentMap and from cache in executor when there are invalid segments
+          DataMapStoreManager.getInstance().clearInvalidSegments(table, invalidSegments);
         }
-        dataMaps = tableDataMap.getTableDataMaps(distributable.getDistributable());
-        List<ExtendedBlocklet> blocklets = tableDataMap
-            .prune(dataMaps,
-                distributable.getDistributable(),
+        SegmentUpdateStatusManager updateStatusManager = new SegmentUpdateStatusManager(table);
+        DataMapStoreManager.getInstance()
+            .refreshSegmentCacheIfRequired(table, updateStatusManager, segmentsToLoad);
+        List<ExtendedBlocklet> blocklets = new ArrayList<>();
+        if (dataMapExprWrapper instanceof DataMapExprWrapperImpl) {
+          TableDataMap defaultDataMap = DataMapStoreManager.getInstance()
+              .getDataMap(table, distributable.getDistributable().getDataMapSchema());
+          dataMaps = defaultDataMap.getTableDataMaps(distributable.getDistributable());
+          if (table.isTransactionalTable()) {
+            blocklets = defaultDataMap.prune(dataMaps, distributable.getDistributable(),
                 dataMapExprWrapper.getFilterResolverIntf(distributable.getUniqueId()), partitions);
-        for (ExtendedBlocklet blocklet : blocklets) {
-          blocklet.getDetailInfo();
-          blocklet.setDataMapUniqueId(distributable.getUniqueId());
+          } else {
+            blocklets = defaultDataMap.prune(segmentsToLoad, filterResolverIntf, partitions);
+          }
+          blocklets = DataMapUtil
+              .pruneDataMaps(table, filterResolverIntf, segmentsToLoad, partitions, blocklets);
+        } else {
+          blocklets = DataMapUtil
+              .pruneDataMaps(table, filterResolverIntf, segmentsToLoad, partitions, blocklets,
+                  dataMapLevel);
         }
         blockletIterator = blocklets.iterator();
       }
 
-      @Override
-      public boolean nextKeyValue() throws IOException, InterruptedException {
+      @Override public boolean nextKeyValue() throws IOException, InterruptedException {
 
 Review comment:
   The defined core formatted for carbon puts the @Override in the same line as the signature.

----------------------------------------------------------------
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