private void addTableDropPartsOutputs(Table table, Collection<List<ExprNodeGenericFuncDesc>> partitionSpecs,
      boolean throwIfNonExistent, boolean  dropPartUseBase) throws SemanticException {
    WriteType writeType =
        dropPartUseBase ? WriteType.DDL_EXCL_WRITE : WriteType.DDL_EXCLUSIVE;

    for (List<ExprNodeGenericFuncDesc> specs : partitionSpecs) {
      for (ExprNodeGenericFuncDesc partitionSpec : specs) {
        List<Partition> parts = new ArrayList<>();

        boolean hasUnknown = false;
        try {
          hasUnknown = db.getPartitionsByExpr(table, partitionSpec, conf, parts);
        } catch (Exception e) {
          throw new SemanticException("Error fetching partitions for " + partitionSpec.getExprString() +
             ", message: " + e.getMessage(), e);
        }
        if (hasUnknown) {
          throw new SemanticException("Unexpected unknown partitions for " + partitionSpec.getExprString());
        }

        // TODO: ifExists could be moved to metastore. In fact it already supports that. Check it
        //       for now since we get parts for output anyway, so we can get the error message
        //       earlier... If we get rid of output, we can get rid of this.
        if (parts.isEmpty()) {
          if (throwIfNonExistent) {
            throw new SemanticException(ErrorMsg.INVALID_PARTITION.getMsg(partitionSpec.getExprString()));
          }
        }
        for (Partition p : parts) {
          outputs.add(new WriteEntity(p, writeType));
        }
      }
    }
  }
Add the table partitions to be modified in the output, so that it is available for the
pre-execution hook. If the partition does not exist, throw an error if
throwIfNonExistent is true, otherwise ignore it.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/drop/AbstractDropPartitionAnalyzer.java