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_r267315096
##########
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:
It should just return long, not Map.
----------------------------------------------------------------
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