public void prune() throws SerDeException, IOException, InterruptedException, HiveException {
    if (sourcesWaitingForEvents.isEmpty()) {
      return;
    }

    Set<VertexState> states = Collections.singleton(VertexState.SUCCEEDED);
    for (String source : sourcesWaitingForEvents) {
      // we need to get state transition updates for the vertices that will send
      // events to us. once we have received all events and a vertex has succeeded,
      // we can move to do the pruning.
      context.registerForVertexStateUpdates(source, states);
    }

    LOG.info("Waiting for events ({} sources) ...", sourceInfoCount);
    // synchronous event processing loop. Won't return until all events have
    // been processed.
    this.processEvents();
    this.prunePartitions();
    LOG.info("Ok to proceed.");
  }
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