core/src/main/java/org/apache/carbondata/core/metadata/PartitionMapFileStore.java
/**
   * Drops the partitions from the partition mapper file of the segment and writes to a new file.
   * @param segmentPath
   * @param partitionsToDrop
   * @param uniqueId
   * @param partialMatch  If it is true then even the partial partition spec matches also can be
   *                      dropped
   * @throws IOException
   */
Drops the partitions from the partition mapper file of the segment and writes to a new file.
Drops the partitions from the partition mapper file of the segment and writes to a new file .
public void dropPartitions(String segmentPath, List<String> partitionsToDrop, String uniqueId,
      boolean partialMatch) throws IOException {
    readAllPartitionsOfSegment(segmentPath);
    List<String> indexesToDrop = new ArrayList<>();
    for (Map.Entry<String, List<String>> entry: partitionMap.entrySet()) {
      if (partialMatch) {
        if (entry.getValue().containsAll(partitionsToDrop)) {
          indexesToDrop.add(entry.getKey());
        }
      } else {
        if (partitionsToDrop.containsAll(entry.getValue())) {
          indexesToDrop.add(entry.getKey());
        }
      }
    }
    if (indexesToDrop.size() > 0) {
      for (String indexToDrop : indexesToDrop) {
        partitionMap.remove(indexToDrop);
      }
      PartitionMapper mapper = new PartitionMapper();
      mapper.setPartitionMap(partitionMap);
      String path = segmentPath + "/" + uniqueId + CarbonTablePath.PARTITION_MAP_EXT + ".tmp";
      writePartitionFile(mapper, path);
    }
  }
public void dropPartitions ( String segmentPath , List < String > partitionsToDrop , String uniqueId , boolean partialMatch ) throws IOException { readAllPartitionsOfSegment ( segmentPath ) ; List < String > indexesToDrop = new ArrayList < > ( ) ; for ( Map . Entry < String , List < String > > entry : partitionMap . entrySet ( ) ) { if ( partialMatch ) { if ( entry . getValue ( ) . containsAll ( partitionsToDrop ) ) { indexesToDrop . add ( entry . getKey ( ) ) ; } } else { if ( partitionsToDrop . containsAll ( entry . getValue ( ) ) ) { indexesToDrop . add ( entry . getKey ( ) ) ; } } } if ( indexesToDrop . size ( ) > 0 ) { for ( String indexToDrop : indexesToDrop ) { partitionMap . remove ( indexToDrop ) ; } PartitionMapper mapper = new PartitionMapper ( ) ; mapper . setPartitionMap ( partitionMap ) ; String path = segmentPath + "/" + uniqueId + CarbonTablePath . PARTITION_MAP_EXT + ".tmp" ; writePartitionFile ( mapper , path ) ; } }
Drops the partitions from the partition mapper file of the segment and writes to a new file.
Drops the partitions from the partition mapper file of the segment and writes to a new file .
// Remove the indexes from partition map