@SuppressWarnings("rawtypes")
  private void applyFilterToPartitions(Converter converter, ExprNodeEvaluator eval,
      String columnName, Set<Object> values, boolean mustKeepOnePartition) throws HiveException {

    Object[] row = new Object[1];

    Iterator<Path> it = work.getPathToPartitionInfo().keySet().iterator();
    while (it.hasNext()) {
      Path p = it.next();
      PartitionDesc desc = work.getPathToPartitionInfo().get(p);
      Map<String, String> spec = desc.getPartSpec();
      if (spec == null) {
        throw new IllegalStateException("No partition spec found in dynamic pruning");
      }

      String partValueString = spec.get(columnName);
      if (partValueString == null) {
        throw new IllegalStateException("Could not find partition value for column: " + columnName);
      }

      Object partValue = converter.convert(partValueString);
      LOG.debug("Converted partition value: {} original ({})", partValue, partValueString);

      row[0] = partValue;
      partValue = eval.evaluate(row);
      LOG.debug("part key expr applied: {}", partValue);

      if (!values.contains(partValue) && (!mustKeepOnePartition || work.getPathToPartitionInfo().size() > 1)) {
        LOG.info("Pruning path: {}", p);
        it.remove();
        // work.removePathToPartitionInfo(p);
        work.removePathToAlias(p);
      }
    }
  }
DynamicPartitionPruner takes a list of assigned partitions at runtime (split
generation) and prunes them using events generated during execution of the
dag.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DynamicPartitionPruner.java