@Test
  public void testDropMissingPartitionsByFilter() throws Throwable {
    String dbName = Warehouse.DEFAULT_DATABASE_NAME;
    String tableName = "table_for_testDropMissingPartitionsByFilter";

    Table table = createPartitionedTable(dbName, tableName);
    for (int i = 10; i <= 12; i++) {
      Map<String, String> partitionSpec = new ImmutableMap.Builder<String, String>()
          .put("ds", "20231129")
          .put("hr", String.valueOf(i))
          .build();
      hm.createPartition(table, partitionSpec);
    }

    List<Partition> partitions = hm.getPartitions(table);
    assertEquals(3, partitions.size());

    // drop partitions by filter with missing predicate
    try {
      List<Pair<Integer, byte[]>> partExprs = new ArrayList<>();
      ExprNodeColumnDesc column = new ExprNodeColumnDesc(
          TypeInfoFactory.stringTypeInfo, "ds", null, true);
      List<String> values = Arrays.asList("20231130", "20231129");
      for (int i = 0; i < values.size(); i++) {
        ExprNodeGenericFuncDesc expr = PartitionUtils.makeBinaryPredicate(
            "=", column, new ExprNodeConstantDesc(TypeInfoFactory.stringTypeInfo, values.get(i)));
        partExprs.add(Pair.of(i, SerializationUtilities.serializeObjectWithTypeInformation(expr)));
      }
      hm.dropPartitions(dbName, tableName, partExprs, PartitionDropOptions.instance());
      fail("Expected exception");
    } catch (HiveException e) {
      // expected
      assertEquals("Some partitions to drop are missing", e.getCause().getMessage());
      assertEquals(3, hm.getPartitions(table).size());
    } finally {
      cleanUpTableQuietly(dbName, tableName);
    }
  }
Test for PURGE support for dropping partitions.
1. Drop partitions without PURGE, and check that the data isn't moved to Trash.
2. Drop partitions with PURGE, and check that the data is moved to Trash.
@throws Exception on failure.
ql/src/test/org/apache/hadoop/hive/ql/metadata/TestHive.java