core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java
/**
   * This method will create new segment id
   *
   * @param loadMetadataDetails
   * @return
   */
This method will create new segment id
@param loadMetadataDetails
@return
This method will create new segment id @param loadMetadataDetails @return
public static int createNewSegmentId(LoadMetadataDetails[] loadMetadataDetails) {
    int newSegmentId = -1;
    for (int i = 0; i < loadMetadataDetails.length; i++) {
      try {
        int loadCount = Integer.parseInt(loadMetadataDetails[i].getLoadName());
        if (newSegmentId < loadCount) {
          newSegmentId = loadCount;
        }
      } catch (NumberFormatException ne) {
        String loadName = loadMetadataDetails[i].getLoadName();
        if (loadName.contains(".")) {
          int loadCount = Integer.parseInt(loadName.split("\\.")[0]);
          if (newSegmentId < loadCount) {
            newSegmentId = loadCount;
          }
        }
      }
    }
    newSegmentId++;
    return newSegmentId;
  }
public static int createNewSegmentId ( LoadMetadataDetails [ ] loadMetadataDetails ) { int newSegmentId = - 1 ; for ( int i = 0 ; i < loadMetadataDetails . length ; i ++ ) { try { int loadCount = Integer . parseInt ( loadMetadataDetails [ i ] . getLoadName ( ) ) ; if ( newSegmentId < loadCount ) { newSegmentId = loadCount ; } } catch ( NumberFormatException ne ) { String loadName = loadMetadataDetails [ i ] . getLoadName ( ) ; if ( loadName . contains ( "." ) ) { int loadCount = Integer . parseInt ( loadName . split ( "\\." ) [ 0 ] ) ; if ( newSegmentId < loadCount ) { newSegmentId = loadCount ; } } } } newSegmentId ++ ; return newSegmentId ; }
This method will create new segment id
 @param loadMetadataDetails
 @return
This method will create new segment id @param loadMetadataDetails @return
// this case is for compacted folders. For compacted folders Id will be like 0.1, 2.1 // consider a case when 12 loads are completed and after that major compaction is triggered. // In this case new compacted folder will be created with name 12.1 and after query time // out all the compacted folders will be deleted and entry will also be removed from the // table status file. In that case also if a new load comes the new segment Id assigned // should be 13 and not 0