@Override
  public List<String> listPartitionNames(final String catName, final String dbName, final String tblName,
      final String defaultPartName, final byte[] exprBytes,
      final String order, final int maxParts) throws MetaException, NoSuchObjectException {
    final String defaultPartitionName = getDefaultPartitionName(defaultPartName);
    final boolean isEmptyFilter = exprBytes.length == 1 && exprBytes[0] == -1;
    ExpressionTree tmp = null;
    if (!isEmptyFilter) {
      tmp = PartFilterExprUtil.makeExpressionTree(expressionProxy, exprBytes,
          getDefaultPartitionName(defaultPartName), conf);
    }
    final ExpressionTree exprTree = tmp;
    return new GetListHelper<String>(catName, dbName, tblName, true, true) {
      private List<String> getPartNamesPrunedByExpr(Table table, boolean isJdoQuery) throws MetaException {
        int max = isEmptyFilter ? maxParts : -1;
        List<String> result;
        if (isJdoQuery) {
          result = getPartitionNamesViaOrm(catName, dbName, tblName, ExpressionTree.EMPTY_TREE,
              order, max, true, table.getPartitionKeys());
        } else {
          SqlFilterForPushdown filter = new SqlFilterForPushdown(table, false);
          result = directSql.getPartitionNamesViaSql(filter, table.getPartitionKeys(),
              defaultPartitionName, order, max);
        }
        if (!isEmptyFilter) {
          prunePartitionNamesByExpr(catName, dbName, tblName, result,
              new GetPartitionsArgs.GetPartitionsArgsBuilder()
                  .expr(exprBytes).defaultPartName(defaultPartName).max(maxParts).build());
        }
        return result;
      }
      @Override
      protected List<String> getSqlResult(GetHelper<List<String>> ctx) throws MetaException {
        SqlFilterForPushdown filter = new SqlFilterForPushdown(ctx.getTable(), false);
        List<String> partNames = null;
        Table table = ctx.getTable();
        if (exprTree != null) {
          if (directSql.generateSqlFilterForPushdown(table.getCatName(), table.getDbName(), table.getTableName(),
              ctx.getTable().getPartitionKeys(), exprTree, defaultPartitionName, filter)) {
            partNames = directSql.getPartitionNamesViaSql(filter, table.getPartitionKeys(),
                defaultPartitionName, order, (int)maxParts);
          }
        }
        if (partNames == null) {
          partNames = getPartNamesPrunedByExpr(table, false);
        }
        return partNames;
      }
      @Override
      protected List<String> getJdoResult(
          GetHelper<List<String>> ctx) throws MetaException, NoSuchObjectException {
        List<String> result = null;
        if (exprTree != null) {
          try {
            result = getPartitionNamesViaOrm(catName, dbName, tblName, exprTree, order,
                maxParts, true, ctx.getTable().getPartitionKeys());
          } catch (MetaException e) {
            result = null;
          }
        }
        if (result == null) {
          result = getPartNamesPrunedByExpr(ctx.getTable(), true);
        }
        return result;
      }
    }.run(true);
  }
Drop an MPartition and cascade deletes (e.g., delete partition privilege grants,
  drop the storage descriptor cleanly, etc.)
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java