niuge01 commented on a change in pull request #3816:
URL: https://github.com/apache/carbondata/pull/3816#discussion_r447366192



##########
File path: 
hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonTableInputFormat.java
##########
@@ -232,47 +233,40 @@
   private List<Segment> getFilteredSegment(JobContext job, List<Segment> 
validSegments,
       boolean validationRequired, ReadCommittedScope readCommittedScope) {
     Segment[] segmentsToAccess = getSegmentsToAccess(job, readCommittedScope);
-    List<Segment> segmentToAccessSet =
-        new ArrayList<>(new HashSet<>(Arrays.asList(segmentsToAccess)));
-    List<Segment> filteredSegmentToAccess = new ArrayList<>();
+    Map<String, Segment> filteredSegmentToAccess = new HashMap<>();

Review comment:
       Move this line to line 244

##########
File path: 
hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonTableInputFormat.java
##########
@@ -232,47 +233,40 @@
   private List<Segment> getFilteredSegment(JobContext job, List<Segment> 
validSegments,
       boolean validationRequired, ReadCommittedScope readCommittedScope) {
     Segment[] segmentsToAccess = getSegmentsToAccess(job, readCommittedScope);
-    List<Segment> segmentToAccessSet =
-        new ArrayList<>(new HashSet<>(Arrays.asList(segmentsToAccess)));
-    List<Segment> filteredSegmentToAccess = new ArrayList<>();
+    Map<String, Segment> filteredSegmentToAccess = new HashMap<>();
     if (segmentsToAccess.length == 0 || 
segmentsToAccess[0].getSegmentNo().equalsIgnoreCase("*")) {
-      filteredSegmentToAccess.addAll(validSegments);
+      return validSegments;
     } else {
+      Map<String, Segment> segmentToAccessMap = new HashMap<>();

Review comment:
       should initialize map capacity with segmentsToAssess size.




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


Reply via email to