This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 633af371edf HIVE-28345: Avoid redundant HiveConf creation in 
MiniHS2.Builder (Stamatis Zampetakis reviewed by Shohei Okumiya, Simhadri 
Govindappa)
633af371edf is described below

commit 633af371edf0823967da2dca50c3893855dab626
Author: Stamatis Zampetakis <[email protected]>
AuthorDate: Mon Jun 24 14:13:12 2024 +0200

    HIVE-28345: Avoid redundant HiveConf creation in MiniHS2.Builder (Stamatis 
Zampetakis reviewed by Shohei Okumiya, Simhadri Govindappa)
    
    Every creation of a MiniHS2.Builder object triggers the creation  of a 
HiveConf object. In many cases this new configuration object is thrown away and 
replaced by another conf object via the withConf method.
    
    Creating a HiveConf object is computationally heavy so for performance 
reasons its best to avoid it when possible.
    
    Close apache/hive#5318
---
 itests/util/src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/itests/util/src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java 
b/itests/util/src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java
index 6eb3a634723..9aab72a933a 100644
--- a/itests/util/src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java
+++ b/itests/util/src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java
@@ -97,7 +97,7 @@ public class MiniHS2 extends AbstractHiveService {
   }
 
   public static class Builder {
-    private HiveConf hiveConf = new HiveConf();
+    private HiveConf hiveConf = null;
     private MiniClusterType miniClusterType = MiniClusterType.LOCALFS_ONLY;
     private boolean useMiniKdc = false;
     private String serverPrincipal;
@@ -194,6 +194,9 @@ public class MiniHS2 extends AbstractHiveService {
       if (miniClusterType == MiniClusterType.MR && useMiniKdc) {
         throw new IOException("Can't create secure miniMr ... yet");
       }
+      if (hiveConf == null) {
+        this.hiveConf = new HiveConf();
+      }
       Iterator<Map.Entry<String, String>> iter = hiveConf.iterator();
       while (iter.hasNext()) {
         String key = iter.next().getKey();

Reply via email to