@Override
  public List<Partition> dropPartitions(String catName, String dbName, String tblName,
                                        List<Pair<Integer, byte[]>> partExprs,
                                        PartitionDropOptions options) throws TException {
    RequestPartsSpec rps = new RequestPartsSpec();
    List<DropPartitionsExpr> exprs = new ArrayList<>(partExprs.size());
    Table table = getTable(catName, dbName, tblName);
    HiveMetaHook hook = getHook(table);
    EnvironmentContext context = new EnvironmentContext();
    if (hook != null) {
      hook.preDropPartitions(table, context, partExprs);
    }
    if (context.getProperties() != null &&
        Boolean.parseBoolean(context.getProperties().get(SKIP_DROP_PARTITION))) {
      return Lists.newArrayList();
    }
    for (Pair<Integer, byte[]> partExpr : partExprs) {
      DropPartitionsExpr dpe = new DropPartitionsExpr();
      dpe.setExpr(partExpr.getRight());
      dpe.setPartArchiveLevel(partExpr.getLeft());
      exprs.add(dpe);
    }
    rps.setExprs(exprs);
    DropPartitionsRequest req = new DropPartitionsRequest(dbName, tblName, rps);
    req.setCatName(catName);
    req.setDeleteData(options.deleteData);
    req.setNeedResult(options.returnResults);
    req.setIfExists(options.ifExists);

    if (options.purgeData) {
      LOG.info("Dropped partitions will be purged!");
      context.putToProperties("ifPurge", "true");
    }
    if (options.writeId != null) {
      context = Optional.ofNullable(context).orElse(new EnvironmentContext());
      context.putToProperties(hive_metastoreConstants.WRITE_ID, options.writeId.toString());
    }
    if (options.txnId != null) {
      context = Optional.ofNullable(context).orElse(new EnvironmentContext());
      context.putToProperties(hive_metastoreConstants.TXN_ID, options.txnId.toString());
    }
    req.setEnvironmentContext(context);
    boolean skipColumnSchemaForPartition = MetastoreConf.getBoolVar(conf, ConfVars.METASTORE_CLIENT_FIELD_SCHEMA_FOR_PARTITIONS);
    req.setSkipColumnSchemaForPartition(skipColumnSchemaForPartition);

    return client.drop_partitions_req(req).getPartitions();
  }
Handles dropDatabase by invoking drop_database in HMS.
Useful when table list in DB can fit in memory, it will retrieve all tables at once and
call drop_database once. Also handles drop_table hooks.
@param req
@param tableList
@throws TException
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java