private void dropPartitionForReplication(Table table, ReplicationSpec replicationSpec) throws HiveException {
    /**
     * ALTER TABLE DROP PARTITION ... FOR REPLICATION(x) behaves as a DROP PARTITION IF OLDER THAN x
     *
     * So, we check each partition that matches our DropTableDesc.getPartSpecs(), and drop it only
     * if it's older than the event that spawned this replicated request to drop partition
     */
    if (table == null) {
      // If table is missing, then partitions are also would've been dropped. Just no-op.
      return;
    }

    Map<String, String> dbParams = context.getDb().getDatabase(table.getDbName()).getParameters();
    for (AlterTableDropPartitionDesc.PartitionDesc partSpec : desc.getPartSpecs()) {
      List<Partition> partitions = new ArrayList<>();
      try {
        context.getDb().getPartitionsByExpr(table, partSpec.getPartSpec(), context.getConf(), partitions);
        // Check if that is a comeback from a checkpoint, if not call normal drop partition.
        boolean modifySinglePartition = false;
        for (Partition p : partitions) {
          if (p != null && !replicationSpec.allowEventReplacementInto(dbParams)) {
            modifySinglePartition = true;
            break;
          }
        }
        // If there is no partition which has an older state. we are in normal flow, we can go ahead with calling the
        // regular drop partition with all the partitions specified in one go.
        if (!modifySinglePartition) {
          LOG.info("Replication calling normal drop partitions for regular partition drops {}", partitions);
          dropPartitions(true);
        } else {
          for (Partition p : partitions) {
            if (replicationSpec.allowEventReplacementInto(dbParams)) {
              PartitionDropOptions options =
                  PartitionDropOptions.instance().deleteData(desc.getDeleteData())
                    .setWriteId(desc.getWriteId());
              context.getDb().dropPartition(table.getDbName(), table.getTableName(), p.getValues(), options);
            }
          }
        }
      } catch (NoSuchObjectException e) {
        // ignore NSOE because that means there's nothing to drop.
      } catch (Exception e) {
        throw new HiveException(e.getMessage(), e);
      }
    }
  }
Operation process of dropping some partitions of a table.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/drop/AlterTableDropPartitionOperation.java