Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,20 @@ private static int[] findSubVariable(String eval) {
return result;
}

/**
* Provides a public wrapper over substituteVars in order to avoid compatibility issues.
* See YARN-11013 for further details.
*
* @param expr the literal value of a config key
* @return null if expr is null, otherwise the value resulting from expanding
* expr using the algorithm above.
* @throws IllegalArgumentException when more than
* {@link Configuration#MAX_SUBST} replacements are required
*/
public String substituteCommonVariables(String expr) {
return substituteVars(expr);
}

/**
* Attempts to repeatedly expand the value {@code expr} by replacing the
* left-most substring of the form "${var}" in the following precedence order
Expand Down Expand Up @@ -1126,7 +1140,7 @@ private static int[] findSubVariable(String eval) {
* @throws IllegalArgumentException when more than
* {@link Configuration#MAX_SUBST} replacements are required
*/
public String substituteVars(String expr) {
private String substituteVars(String expr) {
if (expr == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static UserWeights createByConfig(
if (m.find()) {
String userName = item.getKey().replaceFirst("\\." + USER_WEIGHT, "");
if (!userName.isEmpty()) {
String value = conf.substituteVars(item.getValue());
String value = conf.substituteCommonVariables(item.getValue());
userWeights.data.put(userName, new Float(value));
}
}
Expand Down