ravipesala commented on a change in pull request #3148: [CARBONDATA-3293] Prune 
datamaps improvement for count(*)
URL: https://github.com/apache/carbondata/pull/3148#discussion_r267493925
 
 

 ##########
 File path: 
core/src/main/java/org/apache/carbondata/core/datamap/TableDataMap.java
 ##########
 @@ -499,4 +501,47 @@ public DataMapFactory getDataMapFactory() {
     }
     return prunedSegments;
   }
+
+  /**
+   * Prune the datamap of the given segments and return the Map of blocklet 
path and row count
+   *
+   * @param segments
+   * @param partitions
+   * @return
+   * @throws IOException
+   */
+  public Map<String, Long> getBlockRowCount(List<Segment> segments,
+      final List<PartitionSpec> partitions, TableDataMap defaultDataMap)
+      throws IOException {
+    Map<String, Long> blockletToRowCountMap = new HashMap<>();
+    for (Segment segment : segments) {
+      List<CoarseGrainDataMap> dataMaps = 
defaultDataMap.getDataMapFactory().getDataMaps(segment);
+      for (CoarseGrainDataMap dataMap : dataMaps) {
+        dataMap.getRowCountForEachBlock(segment, partitions, 
blockletToRowCountMap);
+      }
+    }
+    return blockletToRowCountMap;
+  }
+
+  /**
+   * Prune the datamap of the given segments and return the Map of blocklet 
path and row count
+   *
+   * @param segments
+   * @param partitions
+   * @return
+   * @throws IOException
+   */
+  public Map<String, Long> getRowCount(List<Segment> segments,
 
 Review comment:
   I am aware of IUD scenario but  I am not sure why IUD scenario related to 
datamap in this API, If your API says `getRowCount` then just return the row 
count as long , not the Map. Caller methods should handle the IUD scenarios, 
not in this API. 

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


With regards,
Apache Git Services

Reply via email to