harshal-16 commented on code in PR #5744:
URL: https://github.com/apache/hive/pull/5744#discussion_r2209789352
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/util/ReplUtils.java:
##########
@@ -361,8 +361,8 @@ public static boolean isCreateOperation(DDLOperation<?>
ddlOperation) {
}
private static String getMetricStageName(String stageName,
ReplicationMetricCollector metricCollector) {
- if( stageName == "REPL_DUMP" || stageName == "REPL_LOAD" || stageName ==
"ATLAS_DUMP" || stageName == "ATLAS_LOAD"
- || stageName == "RANGER_DUMP" || stageName == "RANGER_LOAD" ||
stageName == "RANGER_DENY"){
+ if( "REPL_DUMP".equals(stageName) || "REPL_LOAD".equals(stageName) ||
"ATLAS_DUMP".equals(stageName) || "ATLAS_LOAD".equals(stageName)
Review Comment:
Old code also works because Java uses constant folding at compile time for
optimization.
and this stageName comes from private final String STAGE_NAME = "REPL_LOAD";
but to make it consistent with non-final fields, .equals() is a better
option.
You can check the first answer from this.
https://stackoverflow.com/questions/8581824/does-java-compiler-include-string-constant-folding
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]