QiangCai commented on a change in pull request #3860:
URL: https://github.com/apache/carbondata/pull/3860#discussion_r460716433



##########
File path: 
core/src/main/java/org/apache/carbondata/core/index/dev/expr/AndIndexExprWrapper.java
##########
@@ -47,25 +47,20 @@ public AndIndexExprWrapper(IndexExprWrapper left, 
IndexExprWrapper right,
   }
 
   @Override
-  public List<ExtendedBlocklet> prune(List<Segment> segments, 
List<PartitionSpec> partitionsToPrune)
-      throws IOException {
-    List<ExtendedBlocklet> leftPrune = left.prune(segments, partitionsToPrune);
-    List<ExtendedBlocklet> rightPrune = right.prune(segments, 
partitionsToPrune);
-    List<ExtendedBlocklet> andBlocklets = new ArrayList<>();
-    for (ExtendedBlocklet blocklet : leftPrune) {
-      if (rightPrune.contains(blocklet)) {
-        andBlocklets.add(blocklet);
-      }
-    }
-    return andBlocklets;
+  public List<ExtendedBlocklet> prune(List<Segment> segments,
+      List<PartitionSpec> partitionsToPrune) throws IOException {
+    return and(left.prune(segments, partitionsToPrune), right.prune(segments, 
partitionsToPrune));
   }
 
   @Override
   public List<ExtendedBlocklet> prune(IndexInputSplit distributable,
-      List<PartitionSpec> partitionsToPrune)
-          throws IOException {
-    List<ExtendedBlocklet> leftPrune = left.prune(distributable, 
partitionsToPrune);
-    List<ExtendedBlocklet> rightPrune = right.prune(distributable, 
partitionsToPrune);
+      List<PartitionSpec> partitionsToPrune) throws IOException {
+    return and(left.prune(distributable, partitionsToPrune),
+        right.prune(distributable, partitionsToPrune));
+  }
+
+  private List<ExtendedBlocklet> and(List<ExtendedBlocklet> leftPrune,
+      List<ExtendedBlocklet> rightPrune) {

Review comment:
       done




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


Reply via email to