private void processEvents() throws SerDeException, IOException, InterruptedException {
    int eventCount = 0;

    while (true) {
      Object element = queue.take();

      if (element == VERTEX_FINISH_TOKEN) {
        String updatedSource = finishedVertices.poll();
        calculateFinishCondition(updatedSource);
        if (checkForSourceCompletion(updatedSource)) {
          break;
        }
      } else {
        InputInitializerEvent event = (InputInitializerEvent) element;
        ByteBuffer payload = event.getUserPayload();
        numEventsSeenPerSource.computeIfAbsent(event.getSourceVertexName(), vn -> new MutableInt(0))
            .increment();

        totalEventCount++;
        LOG.info("Input event ({} -> {} {}), event payload size: {}", event.getSourceVertexName(),
            event.getTargetVertexName(), event.getTargetInputName(), (payload.limit() - payload.position()));
        processPayload(event.getUserPayload(), event.getSourceVertexName());
        eventCount += 1;
        if (checkForSourceCompletion(event.getSourceVertexName())) {
          break;
        }
      }
    }
    LOG.info("Received events: {}", eventCount);
  }
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