public String substitute(HiveConf conf, String expr) {
    if (expr == null) {
      return expr;
    }
    if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_VARIABLE_SUBSTITUTE)) {
      l4j.debug("Substitution is on: " + expr);
    } else {
      return expr;
    }
    int depth = HiveConf.getIntVar(conf, HiveConf.ConfVars.HIVE_VARIABLE_SUBSTITUTE_DEPTH);
    return substitute(conf, expr, depth);
  }
The super method will handle with the case of substitutions for system variables,
hive conf variables and env variables. In this method, it will retrieve the hive
variables using hiveVariableSource.

@param conf
@param var
@return
common/src/java/org/apache/hadoop/hive/conf/VariableSubstitution.java