[GitHub] [carbondata] kunal642 commented on a change in pull request #3707: [CARBONDATA-3781] Refactor code to optimize partition pruning

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 #3707: [CARBONDATA-3781] Refactor code to optimize partition pruning

GitBox

kunal642 commented on a change in pull request #3707:
URL: https://github.com/apache/carbondata/pull/3707#discussion_r415530526



##########
File path: core/src/main/java/org/apache/carbondata/core/index/TableIndex.java
##########
@@ -177,18 +181,29 @@ public CarbonTable getTable() {
   }
 
   private List<ExtendedBlocklet> pruneWithoutFilter(List<Segment> segments,
-      List<PartitionSpec> partitions, List<ExtendedBlocklet> blocklets) throws IOException {
+      Set<Path> partitionLocations, List<ExtendedBlocklet> blocklets) throws IOException {
     for (Segment segment : segments) {
-      List<Blocklet> allBlocklets = blockletDetailsFetcher.getAllBlocklets(segment, partitions);
+      List<Blocklet> allBlocklets =
+          blockletDetailsFetcher.getAllBlocklets(segment, partitionLocations);
       blocklets.addAll(
           addSegmentId(blockletDetailsFetcher.getExtendedBlocklets(allBlocklets, segment),
               segment));
     }
     return blocklets;
   }
 
+  private Set<Path> getPartitionLocations(List<PartitionSpec> partitionSpecs) {
+    Set<Path> partitionsLocations = new HashSet<>();
+    if (null != partitionSpecs) {
+      for (PartitionSpec partitionSpec : partitionSpecs) {
+        partitionsLocations.add(partitionSpec.getLocation());
+      }
+    }
+    return partitionsLocations;
+  }
+
   private List<ExtendedBlocklet> pruneWithFilter(List<Segment> segments, IndexFilter filter,
-      List<PartitionSpec> partitions, List<ExtendedBlocklet> blocklets,
+      Set<Path> partitionLocations, List<ExtendedBlocklet> blocklets,

Review comment:
       Why not make Set<PartitionSpec > ??
   

##########
File path: core/src/main/java/org/apache/carbondata/core/index/TableIndex.java
##########
@@ -177,18 +181,29 @@ public CarbonTable getTable() {
   }
 
   private List<ExtendedBlocklet> pruneWithoutFilter(List<Segment> segments,
-      List<PartitionSpec> partitions, List<ExtendedBlocklet> blocklets) throws IOException {
+      Set<Path> partitionLocations, List<ExtendedBlocklet> blocklets) throws IOException {
     for (Segment segment : segments) {
-      List<Blocklet> allBlocklets = blockletDetailsFetcher.getAllBlocklets(segment, partitions);
+      List<Blocklet> allBlocklets =
+          blockletDetailsFetcher.getAllBlocklets(segment, partitionLocations);
       blocklets.addAll(
           addSegmentId(blockletDetailsFetcher.getExtendedBlocklets(allBlocklets, segment),
               segment));
     }
     return blocklets;
   }
 
+  private Set<Path> getPartitionLocations(List<PartitionSpec> partitionSpecs) {
+    Set<Path> partitionsLocations = new HashSet<>();
+    if (null != partitionSpecs) {
+      for (PartitionSpec partitionSpec : partitionSpecs) {
+        partitionsLocations.add(partitionSpec.getLocation());
+      }
+    }
+    return partitionsLocations;
+  }
+
   private List<ExtendedBlocklet> pruneWithFilter(List<Segment> segments, IndexFilter filter,
-      List<PartitionSpec> partitions, List<ExtendedBlocklet> blocklets,
+      Set<Path> partitionLocations, List<ExtendedBlocklet> blocklets,

Review comment:
       Why not make Set <PartitionSpec > ??
   

##########
File path: core/src/main/java/org/apache/carbondata/core/index/TableIndex.java
##########
@@ -177,18 +181,29 @@ public CarbonTable getTable() {
   }
 
   private List<ExtendedBlocklet> pruneWithoutFilter(List<Segment> segments,
-      List<PartitionSpec> partitions, List<ExtendedBlocklet> blocklets) throws IOException {
+      Set<Path> partitionLocations, List<ExtendedBlocklet> blocklets) throws IOException {
     for (Segment segment : segments) {
-      List<Blocklet> allBlocklets = blockletDetailsFetcher.getAllBlocklets(segment, partitions);
+      List<Blocklet> allBlocklets =
+          blockletDetailsFetcher.getAllBlocklets(segment, partitionLocations);
       blocklets.addAll(
           addSegmentId(blockletDetailsFetcher.getExtendedBlocklets(allBlocklets, segment),
               segment));
     }
     return blocklets;
   }
 
+  private Set<Path> getPartitionLocations(List<PartitionSpec> partitionSpecs) {
+    Set<Path> partitionsLocations = new HashSet<>();
+    if (null != partitionSpecs) {
+      for (PartitionSpec partitionSpec : partitionSpecs) {
+        partitionsLocations.add(partitionSpec.getLocation());
+      }
+    }
+    return partitionsLocations;
+  }
+
   private List<ExtendedBlocklet> pruneWithFilter(List<Segment> segments, IndexFilter filter,
-      List<PartitionSpec> partitions, List<ExtendedBlocklet> blocklets,
+      Set<Path> partitionLocations, List<ExtendedBlocklet> blocklets,

Review comment:
       Why not make Set < PartitionSpec > ??
   




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