@Override
  public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procContext,
      Object... nodeOutputs)
      throws SemanticException {

    OptimizeTezProcContext context = (OptimizeTezProcContext) procContext;

    AppMasterEventOperator event = (AppMasterEventOperator) nd;
    AppMasterEventDesc desc = event.getConf();

    if (desc.getStatistics().getDataSize() > context.conf
        .getLongVar(ConfVars.TEZ_DYNAMIC_PARTITION_PRUNING_MAX_DATA_SIZE) &&
        (context.pruningOpsRemovedByPriorOpt.isEmpty() ||
         !context.pruningOpsRemovedByPriorOpt.contains(event))) {
      context.pruningOpsRemovedByPriorOpt.add(event);
      GenTezUtils.removeBranch(event);
      // at this point we've found the fork in the op pipeline that has the pruning as a child plan.
      LOG.info("Disabling dynamic pruning for: "
          + ((DynamicPruningEventDesc) desc).getTableScan().getName()
          + ". Expected data size is too big: " + desc.getStatistics().getDataSize());
    }
    return false;
  }
If we expect the number of keys for dynamic pruning to be too large we
disable it.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/RemoveDynamicPruningBySize.java