ajantha-bhat commented on a change in pull request #3568: [CARBONDATA-3658] 
Prune and Cache only Matched partitioned segments for filter on Partitioned 
table
URL: https://github.com/apache/carbondata/pull/3568#discussion_r366136663
 
 

 ##########
 File path: 
core/src/main/java/org/apache/carbondata/core/datamap/TableDataMap.java
 ##########
 @@ -115,11 +115,20 @@ public CarbonTable getTable() {
       final List<PartitionSpec> partitions) throws IOException {
     final List<ExtendedBlocklet> blocklets = new ArrayList<>();
     List<Segment> segments = getCarbonSegments(allsegments);
-    final Map<Segment, List<DataMap>> dataMaps = 
dataMapFactory.getDataMaps(segments);
+    final Map<Segment, List<DataMap>> dataMaps;
+    if (filter == null || filter.isEmpty() || partitions == null || 
partitions.isEmpty()) {
+      dataMaps = dataMapFactory.getDataMaps(segments);
+    } else {
+      dataMaps = dataMapFactory.getDataMaps(segments, partitions);
+    }
     // for non-filter queries
     // for filter queries
     int totalFiles = 0;
     int datamapsCount = 0;
+    // In case if filter has matched partitions, update the segment list
+    if (null != partitions && !partitions.isEmpty()) {
+      segments = new ArrayList<>(dataMaps.keySet());
+    }
 
 Review comment:
   move line 117 in else block, because no need to call getCarbonSegments() in 
this 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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to