private static String getContainerJavaOpts(Configuration conf) {
    String javaOpts = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_TEZ_JAVA_OPTS);
    String logLevel = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_TEZ_LOG_LEVEL);
    List<String> logProps = Lists.newArrayList();
    TezUtils.addLog4jSystemProperties(logLevel, logProps);
    StringBuilder sb = new StringBuilder();
    for (String str : logProps) {
      sb.append(str).append(" ");
    }
    logLevel = sb.toString();

    String finalOpts = null;
    if (HiveConf.getIntVar(conf, HiveConf.ConfVars.HIVE_TEZ_CONTAINER_SIZE) > 0) {
      finalOpts = Strings.nullToEmpty(javaOpts) + " " + logLevel;
    } else {
      if (javaOpts != null && !javaOpts.isEmpty()) {
        LOG.warn(HiveConf.ConfVars.HIVE_TEZ_JAVA_OPTS + " will be ignored because "
                 + HiveConf.ConfVars.HIVE_TEZ_CONTAINER_SIZE + " is not set!");
      }
      finalOpts = logLevel + " " + MRHelpers.getJavaOptsForMRMapper(conf);
    }
    finalOpts += JavaVersionUtils.getAddOpensFlagsIfNeeded();
    LOG.debug("Tez container final opts: {}", finalOpts);
    return finalOpts;
  }
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