[GitHub] [carbondata] dhatchayani commented on a change in pull request #3148: [CARBONDATA-3293] Prune datamaps improvement for count(*)

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

[GitHub] [carbondata] dhatchayani commented on a change in pull request #3148: [CARBONDATA-3293] Prune datamaps improvement for count(*)

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

 ##########
 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:
   This map will have only one entry. We need a map to form BlockMappingVO object which in turn is used in CarbonUpdateUtil#getRowCount method(called from CarbonCountStar), where we check for the IUD scenario.

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