@VisibleForTesting
  protected ExprNodeDesc prunePartitionSingleSource(JobConf jobConf, String source, SourceInfo si)
      throws HiveException {

    if (si.skipPruning.get()) {
      // in this case we've determined that there's too much data
      // to prune dynamically.
      LOG.info("Skip pruning on {}, column {}", source, si.columnName);
      return null;
    }

    Set<Object> values = si.values;
    String columnName = si.columnName;

    if (LOG.isDebugEnabled()) {
      StringBuilder sb = new StringBuilder("Pruning ");
      sb.append(columnName);
      sb.append(" with ");
      for (Object value : values) {
        sb.append(value == null ? null : value.toString());
        sb.append(", ");
      }
      LOG.debug(sb.toString());
    }

    PrimitiveObjectInspector oi =
        PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(TypeInfoFactory
            .getPrimitiveTypeInfo(si.columnType));

    if (si.predicate != null) {
      // If we have a predicate defined then use that for pruning in the TableScan filter
      // Works for StorageHandlers where addDynamicSplitPruningEdge is defined
      List<ExprNodeConstantDesc> dynArgs = values.stream()
          .map(v -> new ExprNodeConstantDesc(oi.getPrimitiveJavaObject(v)))
          .collect(Collectors.toList());

      ExprNodeDesc clone = si.predicate.clone();

      replaceDynamicLists(clone, dynArgs);
      return clone;
    } else {
      // If we have to prune the path list for split generation
      Converter converter =
          ObjectInspectorConverters.getConverter(
              PrimitiveObjectInspectorFactory.javaStringObjectInspector, oi);

      StructObjectInspector soi =
          ObjectInspectorFactory.getStandardStructObjectInspector(
              Collections.singletonList(columnName), Collections.singletonList(oi));

      @SuppressWarnings("rawtypes")
      ExprNodeEvaluator eval = ExprNodeEvaluatorFactory.get(si.partKey);
      eval.initialize(soi);

      applyFilterToPartitions(converter, eval, columnName, values, si.mustKeepOnePartition);
      return null;
    }
  }
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