core/src/main/java/org/apache/carbondata/core/metadata/PartitionMapFileStore.java
/**
   * Merge all partition files in a segment to single file.
   *
   * @param segmentPath
   * @throws IOException
   */
Merge all partition files in a segment to single file.
@param segmentPath
@throws IOException
Merge all partition files in a segment to single file . @param segmentPath @throws IOException
public void mergePartitionMapFiles(String segmentPath, String mergeFileName) throws IOException {
    CarbonFile[] partitionFiles = getPartitionFiles(segmentPath);
    if (partitionFiles != null && partitionFiles.length > 0) {
      PartitionMapper partitionMapper = null;
      for (CarbonFile file : partitionFiles) {
        PartitionMapper localMapper = readPartitionMap(file.getAbsolutePath());
        if (partitionMapper == null && localMapper != null) {
          partitionMapper = localMapper;
        }
        if (localMapper != null) {
          partitionMapper = partitionMapper.merge(localMapper);
        }
      }
      if (partitionMapper != null) {
        String path = segmentPath + "/" + mergeFileName + CarbonTablePath.PARTITION_MAP_EXT;
        writePartitionFile(partitionMapper, path);
        for (CarbonFile file : partitionFiles) {
          if (!FileFactory.deleteAllCarbonFilesOfDir(file)) {
            throw new IOException("Old partition map files cannot be deleted");
          }
        }
      }
    }
  }
public void mergePartitionMapFiles ( String segmentPath , String mergeFileName ) throws IOException { CarbonFile [ ] partitionFiles = getPartitionFiles ( segmentPath ) ; if ( partitionFiles != null && partitionFiles . length > 0 ) { PartitionMapper partitionMapper = null ; for ( CarbonFile file : partitionFiles ) { PartitionMapper localMapper = readPartitionMap ( file . getAbsolutePath ( ) ) ; if ( partitionMapper == null && localMapper != null ) { partitionMapper = localMapper ; } if ( localMapper != null ) { partitionMapper = partitionMapper . merge ( localMapper ) ; } } if ( partitionMapper != null ) { String path = segmentPath + "/" + mergeFileName + CarbonTablePath . PARTITION_MAP_EXT ; writePartitionFile ( partitionMapper , path ) ; for ( CarbonFile file : partitionFiles ) { if ( ! FileFactory . deleteAllCarbonFilesOfDir ( file ) ) { throw new IOException ( "Old partition map files cannot be deleted" ) ; } } } } }
Merge all partition files in a segment to single file.
Merge all partition files in a segment to single file .