okumin commented on code in PR #4731:
URL: https://github.com/apache/hive/pull/4731#discussion_r1335091628


##########
common/src/java/org/apache/hadoop/hive/conf/HiveConf.java:
##########
@@ -6001,18 +6006,24 @@ public void verifyAndSet(String name, String value) 
throws IllegalArgumentExcept
       throw new IllegalArgumentException("Cannot modify " + name + " at 
runtime. It is in the list"
           + " of parameters that can't be modified at runtime or is prefixed 
by a restricted variable");
     }
-    String oldValue = name != null ? get(name) : null;
-    if (name == null || value == null || !value.equals(oldValue)) {
-      // When either name or value is null, the set method below will fail,
-      // and throw IllegalArgumentException
-      set(name, value);
+    if (!isLockedConfig(name)) {

Review Comment:
   I guess it is more flexible if we return here.
   
   ```
   if (isLockedConfig(name)) {
     return;
   }
   String oldValue = name != null ? get(name) : null;
   ...
   ```
   
   Because (1) a kind of cognitive load is lower when we read the succeeding 
lines, (2) we can easily reorder the priority of the whitelist vs restrict list 
vs locked list, and (3) we can easily add another new condition like below 
without an additional nest.
   
   ```
   if (isLockedConfig(name)) {
     return;
   }
   if (isProhibitedKeyAndValue(name, value)) {
     return;
   }
   ```
   
   I personally don't prefer the following shape.
   
   ```
   if (!isLockedConfig(name)) {
     if (!isProhibitedKeyAndValue(name, value)) {
       String oldValue = name != null ? get(name) : null;
       ...
     }
   }
   ```



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to