public static Resource getContainerResource(Configuration conf) {
    int memorySizeMb = HiveConf.getIntVar(conf, HiveConf.ConfVars.HIVE_TEZ_CONTAINER_SIZE);
    if (memorySizeMb <= 0) {
      LOG.warn("No Tez container size specified by {}. Falling back to MapReduce container MB {}",
          HiveConf.ConfVars.HIVE_TEZ_CONTAINER_SIZE,  MRJobConfig.MAP_MEMORY_MB);
      memorySizeMb = conf.getInt(MRJobConfig.MAP_MEMORY_MB, MRJobConfig.DEFAULT_MAP_MEMORY_MB);
      // When config is explicitly set to "-1" defaultValue does not work!
      if (memorySizeMb <= 0) {
        LOG.warn("Falling back to default container MB {}", MRJobConfig.DEFAULT_MAP_MEMORY_MB);
        memorySizeMb = MRJobConfig.DEFAULT_MAP_MEMORY_MB;
      }
    }
    int cpuCores = HiveConf.getIntVar(conf, HiveConf.ConfVars.HIVE_TEZ_CPU_VCORES);
    if (cpuCores <= 0) {
      LOG.warn("No Tez VCore size specified by {}. Falling back to MapReduce container VCores {}",
          HiveConf.ConfVars.HIVE_TEZ_CPU_VCORES,  MRJobConfig.MAP_CPU_VCORES);
      cpuCores = conf.getInt(MRJobConfig.MAP_CPU_VCORES, MRJobConfig.DEFAULT_MAP_CPU_VCORES);
      if (cpuCores <= 0) {
        LOG.warn("Falling back to default container VCores {}", MRJobConfig.DEFAULT_MAP_CPU_VCORES);
        cpuCores = MRJobConfig.DEFAULT_MAP_CPU_VCORES;
      }
    }
    Resource resource = Resource.newInstance(memorySizeMb, cpuCores);
    LOG.debug("Tez container resource: {}", resource);
    return resource;
  }
Utility method to create a stripped down configuration for the MR partitioner.

@param partitionerClassName
         the real MR partitioner class name
@param baseConf
         a base configuration to extract relevant properties
@return
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java