You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by manishgupta88 <gi...@git.apache.org> on 2018/04/26 14:12:12 UTC

[GitHub] carbondata pull request #1812: [CARBONDATA-2033]Support user specified segme...

Github user manishgupta88 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1812#discussion_r184401040
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/merger/CarbonDataMergerUtil.java ---
    @@ -444,6 +450,26 @@ public int compare(LoadMetadataDetails seg1, LoadMetadataDetails seg2) {
         });
       }
     
    +  /**
    +   * This method will return the list of loads which are specified by user in SQL.
    +   *
    +   * @param listOfSegments
    +   * @param segmentIds
    +   * @return
    +   */
    +  private static List<LoadMetadataDetails> identitySegmentsToBeMergedBasedOnSpecifiedSegments(
    +          List<LoadMetadataDetails> listOfSegments,
    +          Set<String> segmentIds) {
    +    List<LoadMetadataDetails> listOfSegmentsSpecified =
    +            new ArrayList<>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
    +    for (LoadMetadataDetails detail : listOfSegments) {
    +      if (isSegmentValid(detail) && segmentIds.contains(detail.getLoadName())) {
    +        listOfSegmentsSpecified.add(detail);
    +      }
    +    }
    +    return listOfSegmentsSpecified;
    --- End diff --
    
    In case of custom compaction user is completely aware of the segments provided in the Alter SQL. Therefore in the segment List provided by the user if any segment is found invalid we should throw exception and compaction process should be aborted


---