You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/08/17 04:36:22 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #3247] Minor clean up Kyuubi JDBC code

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

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b990d718 [KYUUBI #3247] Minor clean up Kyuubi JDBC code
3b990d718 is described below

commit 3b990d718103ba0e4813790e0a2e4f159c53e36c
Author: Cheng Pan <ch...@apache.org>
AuthorDate: Wed Aug 17 12:36:13 2022 +0800

    [KYUUBI #3247] Minor clean up Kyuubi JDBC code
    
    ### _Why are the changes needed?_
    
    Remove used classes `HiveBaseChar`, `HiveChar`, `HiveVarchar`
    Pull out `JdbcConnectionParams` from `Utils`
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #3247 from pan3793/jdbc.
    
    Closes #3247
    
    4dbe289b [Cheng Pan] review
    b6e8d37c [Cheng Pan] kyuubi jdbc code refactor
    
    Authored-by: Cheng Pan <ch...@apache.org>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../org/apache/hive/beeline/KyuubiCommands.java    |   2 +-
 .../org/apache/kyuubi/jdbc/KyuubiHiveDriver.java   |   3 +-
 .../kyuubi/jdbc/hive/JdbcConnectionParams.java     | 226 +++++++++++++++++
 .../apache/kyuubi/jdbc/hive/KyuubiConnection.java  |   3 +-
 .../apache/kyuubi/jdbc/hive/KyuubiDataSource.java  |   4 +-
 .../java/org/apache/kyuubi/jdbc/hive/Utils.java    | 273 ++-------------------
 .../jdbc/hive/ZooKeeperHiveClientHelper.java       |  39 ++-
 .../kyuubi/jdbc/hive/common/HiveBaseChar.java      |  96 --------
 .../apache/kyuubi/jdbc/hive/common/HiveChar.java   |  86 -------
 .../kyuubi/jdbc/hive/common/HiveVarchar.java       |  57 -----
 .../org/apache/kyuubi/jdbc/hive/UtilsTest.java     |   1 -
 11 files changed, 274 insertions(+), 516 deletions(-)

diff --git a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
index a353d7a36..3c153dbe1 100644
--- a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
+++ b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
@@ -21,9 +21,9 @@ import java.io.*;
 import java.sql.*;
 import java.util.*;
 import org.apache.hive.beeline.logs.KyuubiBeelineInPlaceUpdateStream;
+import org.apache.kyuubi.jdbc.hive.JdbcConnectionParams;
 import org.apache.kyuubi.jdbc.hive.KyuubiStatement;
 import org.apache.kyuubi.jdbc.hive.Utils;
-import org.apache.kyuubi.jdbc.hive.Utils.JdbcConnectionParams;
 import org.apache.kyuubi.jdbc.hive.logs.InPlaceUpdateStream;
 import org.apache.kyuubi.jdbc.hive.logs.KyuubiLoggable;
 
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/KyuubiHiveDriver.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/KyuubiHiveDriver.java
index cdb591677..3b874ba2e 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/KyuubiHiveDriver.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/KyuubiHiveDriver.java
@@ -24,6 +24,7 @@ import java.util.Properties;
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
 import java.util.logging.Logger;
+import org.apache.kyuubi.jdbc.hive.JdbcConnectionParams;
 import org.apache.kyuubi.jdbc.hive.KyuubiConnection;
 import org.apache.kyuubi.jdbc.hive.KyuubiSQLException;
 import org.apache.kyuubi.jdbc.hive.Utils;
@@ -125,7 +126,7 @@ public class KyuubiHiveDriver implements Driver {
       throw new KyuubiSQLException("Invalid connection url: " + url);
     }
 
-    Utils.JdbcConnectionParams params;
+    JdbcConnectionParams params;
     try {
       params = Utils.parseURL(url, defaults);
     } catch (Exception e) {
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/JdbcConnectionParams.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/JdbcConnectionParams.java
new file mode 100644
index 000000000..670b7a243
--- /dev/null
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/JdbcConnectionParams.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.jdbc.hive;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class JdbcConnectionParams {
+  // Note on client side parameter naming convention:
+  // Prefer using a shorter camelCase param name instead of using the same name as the
+  // corresponding
+  // HiveServer2 config.
+  // For a jdbc url: jdbc:hive2://<host>:<port>/dbName;sess_var_list?hive_conf_list#hive_var_list,
+  // client side params are specified in sess_var_list
+
+  // Client param names:
+
+  // Retry setting
+  static final String RETRIES = "retries";
+
+  public static final String AUTH_TYPE = "auth";
+  // We're deprecating this variable's name.
+  public static final String AUTH_QOP_DEPRECATED = "sasl.qop";
+  public static final String AUTH_QOP = "saslQop";
+  public static final String AUTH_SIMPLE = "noSasl";
+  public static final String AUTH_USER = "user";
+  public static final String AUTH_PRINCIPAL = "principal";
+  public static final String AUTH_KYUUBI_CLIENT_PRINCIPAL = "kyuubiClientPrincipal";
+  public static final String AUTH_KYUUBI_CLIENT_KEYTAB = "kyuubiClientKeytab";
+  public static final String AUTH_PASSWD = "password";
+  public static final String AUTH_KERBEROS_AUTH_TYPE = "kerberosAuthType";
+  public static final String AUTH_KERBEROS_AUTH_TYPE_FROM_SUBJECT = "fromSubject";
+  public static final String ANONYMOUS_USER = "anonymous";
+  public static final String ANONYMOUS_PASSWD = "anonymous";
+  public static final String USE_SSL = "ssl";
+  public static final String SSL_TRUST_STORE = "sslTrustStore";
+  public static final String SSL_TRUST_STORE_PASSWORD = "trustStorePassword";
+  // We're deprecating the name and placement of this in the parsed map (from hive conf vars to
+  // hive session vars).
+  static final String TRANSPORT_MODE_DEPRECATED = "hive.server2.transport.mode";
+  public static final String TRANSPORT_MODE = "transportMode";
+  // We're deprecating the name and placement of this in the parsed map (from hive conf vars to
+  // hive session vars).
+  static final String HTTP_PATH_DEPRECATED = "hive.server2.thrift.http.path";
+  public static final String HTTP_PATH = "httpPath";
+  public static final String SERVICE_DISCOVERY_MODE = "serviceDiscoveryMode";
+  public static final String PROPERTY_DRIVER = "driver";
+  public static final String PROPERTY_URL = "url";
+  // Don't use dynamic service discovery
+  static final String SERVICE_DISCOVERY_MODE_NONE = "none";
+  // Use ZooKeeper for indirection while using dynamic service discovery
+  static final String SERVICE_DISCOVERY_MODE_ZOOKEEPER = "zooKeeper";
+  static final String ZOOKEEPER_NAMESPACE = "zooKeeperNamespace";
+  // Default namespace value on ZooKeeper.
+  // This value is used if the param "zooKeeperNamespace" is not specified in the JDBC Uri.
+  static final String ZOOKEEPER_DEFAULT_NAMESPACE = "hiveserver2";
+  static final String COOKIE_AUTH = "cookieAuth";
+  static final String COOKIE_NAME = "cookieName";
+  // The default value of the cookie name when CookieAuth=true
+  static final String DEFAULT_COOKIE_NAMES_HS2 = "hive.server2.auth";
+  // The http header prefix for additional headers which have to be appended to the request
+  static final String HTTP_HEADER_PREFIX = "http.header.";
+  // Set the fetchSize
+  static final String FETCH_SIZE = "fetchSize";
+  static final String INIT_FILE = "initFile";
+  static final String WM_POOL = "wmPool";
+  // Cookie prefix
+  static final String HTTP_COOKIE_PREFIX = "http.cookie.";
+
+  static final String CONNECT_TIMEOUT = "connectTimeout";
+  static final String SOCKET_TIMEOUT = "socketTimeout";
+
+  // We support ways to specify application name modeled after some existing DBs, since
+  // there's no standard approach.
+  // MSSQL: applicationName
+  // https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url
+  // Postgres 9~: ApplicationName https://jdbc.postgresql.org/documentation/91/connect.html
+  // Note: various ODBC names used include "Application Name", "APP", etc. Add those?
+  static final String[] APPLICATION = new String[] {"applicationName", "ApplicationName"};
+
+  // --------------- Begin 2 way ssl options -------------------------
+  // Use two way ssl. This param will take effect only when ssl=true
+  static final String USE_TWO_WAY_SSL = "twoWay";
+  static final String TRUE = "true";
+  static final String SSL_KEY_STORE = "sslKeyStore";
+  static final String SSL_KEY_STORE_PASSWORD = "keyStorePassword";
+  static final String SSL_KEY_STORE_TYPE = "JKS";
+  static final String SUNX509_ALGORITHM_STRING = "SunX509";
+  static final String SUNJSSE_ALGORITHM_STRING = "SunJSSE";
+  // --------------- End 2 way ssl options ----------------------------
+
+  // Non-configurable params:
+  // Currently supports JKS keystore format
+  static final String SSL_TRUST_STORE_TYPE = "JKS";
+
+  static final String HIVE_VAR_PREFIX = "hivevar:";
+  static final String HIVE_CONF_PREFIX = "hiveconf:";
+  private String host = null;
+  private int port = 0;
+  private String jdbcUriString;
+  private String dbName = Utils.DEFAULT_DATABASE;
+  private Map<String, String> hiveConfs = new LinkedHashMap<>();
+  private Map<String, String> hiveVars = new LinkedHashMap<>();
+  private Map<String, String> sessionVars = new LinkedHashMap<>();
+  private String suppliedURLAuthority;
+  private String zooKeeperEnsemble = null;
+  private String currentHostZnodePath;
+  private final List<String> rejectedHostZnodePaths = new ArrayList<>();
+
+  public JdbcConnectionParams() {}
+
+  public JdbcConnectionParams(JdbcConnectionParams params) {
+    this.host = params.host;
+    this.port = params.port;
+    this.jdbcUriString = params.jdbcUriString;
+    this.dbName = params.dbName;
+    this.hiveConfs.putAll(params.hiveConfs);
+    this.hiveVars.putAll(params.hiveVars);
+    this.sessionVars.putAll(params.sessionVars);
+    this.suppliedURLAuthority = params.suppliedURLAuthority;
+    this.zooKeeperEnsemble = params.zooKeeperEnsemble;
+    this.currentHostZnodePath = params.currentHostZnodePath;
+    this.rejectedHostZnodePaths.addAll(params.rejectedHostZnodePaths);
+  }
+
+  public String getHost() {
+    return host;
+  }
+
+  public int getPort() {
+    return port;
+  }
+
+  public String getJdbcUriString() {
+    return jdbcUriString;
+  }
+
+  public String getDbName() {
+    return dbName;
+  }
+
+  public Map<String, String> getHiveConfs() {
+    return hiveConfs;
+  }
+
+  public Map<String, String> getHiveVars() {
+    return hiveVars;
+  }
+
+  public Map<String, String> getSessionVars() {
+    return sessionVars;
+  }
+
+  public String getSuppliedURLAuthority() {
+    return suppliedURLAuthority;
+  }
+
+  public String getZooKeeperEnsemble() {
+    return zooKeeperEnsemble;
+  }
+
+  public List<String> getRejectedHostZnodePaths() {
+    return rejectedHostZnodePaths;
+  }
+
+  public String getCurrentHostZnodePath() {
+    return currentHostZnodePath;
+  }
+
+  public void setHost(String host) {
+    this.host = host;
+  }
+
+  public void setPort(int port) {
+    this.port = port;
+  }
+
+  public void setJdbcUriString(String jdbcUriString) {
+    this.jdbcUriString = jdbcUriString;
+  }
+
+  public void setDbName(String dbName) {
+    this.dbName = dbName;
+  }
+
+  public void setHiveConfs(Map<String, String> hiveConfs) {
+    this.hiveConfs = hiveConfs;
+  }
+
+  public void setHiveVars(Map<String, String> hiveVars) {
+    this.hiveVars = hiveVars;
+  }
+
+  public void setSessionVars(Map<String, String> sessionVars) {
+    this.sessionVars = sessionVars;
+  }
+
+  public void setSuppliedURLAuthority(String suppliedURLAuthority) {
+    this.suppliedURLAuthority = suppliedURLAuthority;
+  }
+
+  public void setZooKeeperEnsemble(String zooKeeperEnsemble) {
+    this.zooKeeperEnsemble = zooKeeperEnsemble;
+  }
+
+  public void setCurrentHostZnodePath(String currentHostZnodePath) {
+    this.currentHostZnodePath = currentHostZnodePath;
+  }
+}
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java
index 333f77d73..d9a6b1d74 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java
@@ -17,9 +17,9 @@
 
 package org.apache.kyuubi.jdbc.hive;
 
+import static org.apache.kyuubi.jdbc.hive.JdbcConnectionParams.*;
 import static org.apache.kyuubi.jdbc.hive.Utils.HIVE_SERVER2_RETRY_KEY;
 import static org.apache.kyuubi.jdbc.hive.Utils.HIVE_SERVER2_RETRY_TRUE;
-import static org.apache.kyuubi.jdbc.hive.Utils.JdbcConnectionParams.*;
 
 import java.io.*;
 import java.lang.reflect.InvocationHandler;
@@ -62,7 +62,6 @@ import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.ssl.SSLContexts;
-import org.apache.kyuubi.jdbc.hive.Utils.JdbcConnectionParams;
 import org.apache.kyuubi.jdbc.hive.adapter.SQLConnection;
 import org.apache.kyuubi.jdbc.hive.auth.*;
 import org.apache.kyuubi.jdbc.hive.cli.FetchType;
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiDataSource.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiDataSource.java
index b4307532d..012ae5424 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiDataSource.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiDataSource.java
@@ -17,8 +17,8 @@
 
 package org.apache.kyuubi.jdbc.hive;
 
-import static org.apache.kyuubi.jdbc.hive.Utils.JdbcConnectionParams.AUTH_PASSWD;
-import static org.apache.kyuubi.jdbc.hive.Utils.JdbcConnectionParams.AUTH_USER;
+import static org.apache.kyuubi.jdbc.hive.JdbcConnectionParams.AUTH_PASSWD;
+import static org.apache.kyuubi.jdbc.hive.JdbcConnectionParams.AUTH_USER;
 
 import java.sql.Connection;
 import java.sql.SQLException;
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java
index 2bac87314..307c7c53d 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java
@@ -17,6 +17,8 @@
 
 package org.apache.kyuubi.jdbc.hive;
 
+import static org.apache.kyuubi.jdbc.hive.JdbcConnectionParams.*;
+
 import java.net.InetAddress;
 import java.net.URI;
 import java.net.UnknownHostException;
@@ -64,209 +66,6 @@ public class Utils {
         "Bad URL format: Missing prefix " + String.join(" or ", URL_PREFIX_LIST));
   }
 
-  public static class JdbcConnectionParams {
-    // Note on client side parameter naming convention:
-    // Prefer using a shorter camelCase param name instead of using the same name as the
-    // corresponding
-    // HiveServer2 config.
-    // For a jdbc url: jdbc:hive2://<host>:<port>/dbName;sess_var_list?hive_conf_list#hive_var_list,
-    // client side params are specified in sess_var_list
-
-    // Client param names:
-
-    // Retry setting
-    static final String RETRIES = "retries";
-
-    public static final String AUTH_TYPE = "auth";
-    // We're deprecating this variable's name.
-    public static final String AUTH_QOP_DEPRECATED = "sasl.qop";
-    public static final String AUTH_QOP = "saslQop";
-    public static final String AUTH_SIMPLE = "noSasl";
-    public static final String AUTH_USER = "user";
-    public static final String AUTH_PRINCIPAL = "principal";
-    public static final String AUTH_KYUUBI_CLIENT_PRINCIPAL = "kyuubiClientPrincipal";
-    public static final String AUTH_KYUUBI_CLIENT_KEYTAB = "kyuubiClientKeytab";
-    public static final String AUTH_PASSWD = "password";
-    public static final String AUTH_KERBEROS_AUTH_TYPE = "kerberosAuthType";
-    public static final String AUTH_KERBEROS_AUTH_TYPE_FROM_SUBJECT = "fromSubject";
-    public static final String ANONYMOUS_USER = "anonymous";
-    public static final String ANONYMOUS_PASSWD = "anonymous";
-    public static final String USE_SSL = "ssl";
-    public static final String SSL_TRUST_STORE = "sslTrustStore";
-    public static final String SSL_TRUST_STORE_PASSWORD = "trustStorePassword";
-    // We're deprecating the name and placement of this in the parsed map (from hive conf vars to
-    // hive session vars).
-    static final String TRANSPORT_MODE_DEPRECATED = "hive.server2.transport.mode";
-    public static final String TRANSPORT_MODE = "transportMode";
-    // We're deprecating the name and placement of this in the parsed map (from hive conf vars to
-    // hive session vars).
-    static final String HTTP_PATH_DEPRECATED = "hive.server2.thrift.http.path";
-    public static final String HTTP_PATH = "httpPath";
-    public static final String SERVICE_DISCOVERY_MODE = "serviceDiscoveryMode";
-    public static final String PROPERTY_DRIVER = "driver";
-    public static final String PROPERTY_URL = "url";
-    // Don't use dynamic service discovery
-    static final String SERVICE_DISCOVERY_MODE_NONE = "none";
-    // Use ZooKeeper for indirection while using dynamic service discovery
-    static final String SERVICE_DISCOVERY_MODE_ZOOKEEPER = "zooKeeper";
-    static final String ZOOKEEPER_NAMESPACE = "zooKeeperNamespace";
-    // Default namespace value on ZooKeeper.
-    // This value is used if the param "zooKeeperNamespace" is not specified in the JDBC Uri.
-    static final String ZOOKEEPER_DEFAULT_NAMESPACE = "hiveserver2";
-    static final String COOKIE_AUTH = "cookieAuth";
-    static final String COOKIE_NAME = "cookieName";
-    // The default value of the cookie name when CookieAuth=true
-    static final String DEFAULT_COOKIE_NAMES_HS2 = "hive.server2.auth";
-    // The http header prefix for additional headers which have to be appended to the request
-    static final String HTTP_HEADER_PREFIX = "http.header.";
-    // Set the fetchSize
-    static final String FETCH_SIZE = "fetchSize";
-    static final String INIT_FILE = "initFile";
-    static final String WM_POOL = "wmPool";
-    // Cookie prefix
-    static final String HTTP_COOKIE_PREFIX = "http.cookie.";
-
-    static final String CONNECT_TIMEOUT = "connectTimeout";
-    static final String SOCKET_TIMEOUT = "socketTimeout";
-
-    // We support ways to specify application name modeled after some existing DBs, since
-    // there's no standard approach.
-    // MSSQL: applicationName
-    // https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url
-    // Postgres 9~: ApplicationName https://jdbc.postgresql.org/documentation/91/connect.html
-    // Note: various ODBC names used include "Application Name", "APP", etc. Add those?
-    static final String[] APPLICATION = new String[] {"applicationName", "ApplicationName"};
-
-    // --------------- Begin 2 way ssl options -------------------------
-    // Use two way ssl. This param will take effect only when ssl=true
-    static final String USE_TWO_WAY_SSL = "twoWay";
-    static final String TRUE = "true";
-    static final String SSL_KEY_STORE = "sslKeyStore";
-    static final String SSL_KEY_STORE_PASSWORD = "keyStorePassword";
-    static final String SSL_KEY_STORE_TYPE = "JKS";
-    static final String SUNX509_ALGORITHM_STRING = "SunX509";
-    static final String SUNJSSE_ALGORITHM_STRING = "SunJSSE";
-    // --------------- End 2 way ssl options ----------------------------
-
-    // Non-configurable params:
-    // Currently supports JKS keystore format
-    static final String SSL_TRUST_STORE_TYPE = "JKS";
-
-    private static final String HIVE_VAR_PREFIX = "hivevar:";
-    private static final String HIVE_CONF_PREFIX = "hiveconf:";
-    private String host = null;
-    private int port = 0;
-    private String jdbcUriString;
-    private String dbName = DEFAULT_DATABASE;
-    private Map<String, String> hiveConfs = new LinkedHashMap<>();
-    private Map<String, String> hiveVars = new LinkedHashMap<>();
-    private Map<String, String> sessionVars = new LinkedHashMap<>();
-    private String suppliedURLAuthority;
-    private String zooKeeperEnsemble = null;
-    private String currentHostZnodePath;
-    private final List<String> rejectedHostZnodePaths = new ArrayList<>();
-
-    public JdbcConnectionParams() {}
-
-    public JdbcConnectionParams(JdbcConnectionParams params) {
-      this.host = params.host;
-      this.port = params.port;
-      this.jdbcUriString = params.jdbcUriString;
-      this.dbName = params.dbName;
-      this.hiveConfs.putAll(params.hiveConfs);
-      this.hiveVars.putAll(params.hiveVars);
-      this.sessionVars.putAll(params.sessionVars);
-      this.suppliedURLAuthority = params.suppliedURLAuthority;
-      this.zooKeeperEnsemble = params.zooKeeperEnsemble;
-      this.currentHostZnodePath = params.currentHostZnodePath;
-      this.rejectedHostZnodePaths.addAll(rejectedHostZnodePaths);
-    }
-
-    public String getHost() {
-      return host;
-    }
-
-    public int getPort() {
-      return port;
-    }
-
-    public String getJdbcUriString() {
-      return jdbcUriString;
-    }
-
-    public String getDbName() {
-      return dbName;
-    }
-
-    public Map<String, String> getHiveConfs() {
-      return hiveConfs;
-    }
-
-    public Map<String, String> getHiveVars() {
-      return hiveVars;
-    }
-
-    public Map<String, String> getSessionVars() {
-      return sessionVars;
-    }
-
-    public String getSuppliedURLAuthority() {
-      return suppliedURLAuthority;
-    }
-
-    public String getZooKeeperEnsemble() {
-      return zooKeeperEnsemble;
-    }
-
-    public List<String> getRejectedHostZnodePaths() {
-      return rejectedHostZnodePaths;
-    }
-
-    public String getCurrentHostZnodePath() {
-      return currentHostZnodePath;
-    }
-
-    public void setHost(String host) {
-      this.host = host;
-    }
-
-    public void setPort(int port) {
-      this.port = port;
-    }
-
-    public void setJdbcUriString(String jdbcUriString) {
-      this.jdbcUriString = jdbcUriString;
-    }
-
-    public void setDbName(String dbName) {
-      this.dbName = dbName;
-    }
-
-    public void setHiveConfs(Map<String, String> hiveConfs) {
-      this.hiveConfs = hiveConfs;
-    }
-
-    public void setHiveVars(Map<String, String> hiveVars) {
-      this.hiveVars = hiveVars;
-    }
-
-    public void setSessionVars(Map<String, String> sessionVars) {
-      this.sessionVars = sessionVars;
-    }
-
-    public void setSuppliedURLAuthority(String suppliedURLAuthority) {
-      this.suppliedURLAuthority = suppliedURLAuthority;
-    }
-
-    public void setZooKeeperEnsemble(String zooKeeperEnsemble) {
-      this.zooKeeperEnsemble = zooKeeperEnsemble;
-    }
-
-    public void setCurrentHostZnodePath(String currentHostZnodePath) {
-      this.currentHostZnodePath = currentHostZnodePath;
-    }
-  }
-
   // Verify success or success_with_info status, else throw SQLException
   static void verifySuccessWithInfo(TStatus status) throws SQLException {
     verifySuccess(status, true);
@@ -397,57 +196,39 @@ public class Utils {
     for (Map.Entry<Object, Object> kv : info.entrySet()) {
       if ((kv.getKey() instanceof String)) {
         String key = (String) kv.getKey();
-        if (key.startsWith(JdbcConnectionParams.HIVE_VAR_PREFIX)) {
+        if (key.startsWith(HIVE_VAR_PREFIX)) {
           connParams
               .getHiveVars()
-              .put(
-                  key.substring(JdbcConnectionParams.HIVE_VAR_PREFIX.length()),
-                  info.getProperty(key));
-        } else if (key.startsWith(JdbcConnectionParams.HIVE_CONF_PREFIX)) {
+              .put(key.substring(HIVE_VAR_PREFIX.length()), info.getProperty(key));
+        } else if (key.startsWith(HIVE_CONF_PREFIX)) {
           connParams
               .getHiveConfs()
-              .put(
-                  key.substring(JdbcConnectionParams.HIVE_CONF_PREFIX.length()),
-                  info.getProperty(key));
+              .put(key.substring(HIVE_CONF_PREFIX.length()), info.getProperty(key));
         }
       }
     }
     // Extract user/password from JDBC connection properties if its not supplied
     // in the connection URL
-    if (!connParams.getSessionVars().containsKey(JdbcConnectionParams.AUTH_USER)) {
-      if (info.containsKey(JdbcConnectionParams.AUTH_USER)) {
-        connParams
-            .getSessionVars()
-            .put(JdbcConnectionParams.AUTH_USER, info.getProperty(JdbcConnectionParams.AUTH_USER));
+    if (!connParams.getSessionVars().containsKey(AUTH_USER)) {
+      if (info.containsKey(AUTH_USER)) {
+        connParams.getSessionVars().put(AUTH_USER, info.getProperty(AUTH_USER));
       }
-      if (info.containsKey(JdbcConnectionParams.AUTH_PASSWD)) {
-        connParams
-            .getSessionVars()
-            .put(
-                JdbcConnectionParams.AUTH_PASSWD,
-                info.getProperty(JdbcConnectionParams.AUTH_PASSWD));
+      if (info.containsKey(AUTH_PASSWD)) {
+        connParams.getSessionVars().put(AUTH_PASSWD, info.getProperty(AUTH_PASSWD));
       }
     }
 
-    if (!connParams.getSessionVars().containsKey(JdbcConnectionParams.AUTH_PASSWD)) {
-      if (info.containsKey(JdbcConnectionParams.AUTH_USER)) {
-        connParams
-            .getSessionVars()
-            .put(JdbcConnectionParams.AUTH_USER, info.getProperty(JdbcConnectionParams.AUTH_USER));
+    if (!connParams.getSessionVars().containsKey(AUTH_PASSWD)) {
+      if (info.containsKey(AUTH_USER)) {
+        connParams.getSessionVars().put(AUTH_USER, info.getProperty(AUTH_USER));
       }
-      if (info.containsKey(JdbcConnectionParams.AUTH_PASSWD)) {
-        connParams
-            .getSessionVars()
-            .put(
-                JdbcConnectionParams.AUTH_PASSWD,
-                info.getProperty(JdbcConnectionParams.AUTH_PASSWD));
+      if (info.containsKey(AUTH_PASSWD)) {
+        connParams.getSessionVars().put(AUTH_PASSWD, info.getProperty(AUTH_PASSWD));
       }
     }
 
-    if (info.containsKey(JdbcConnectionParams.AUTH_TYPE)) {
-      connParams
-          .getSessionVars()
-          .put(JdbcConnectionParams.AUTH_TYPE, info.getProperty(JdbcConnectionParams.AUTH_TYPE));
+    if (info.containsKey(AUTH_TYPE)) {
+      connParams.getSessionVars().put(AUTH_TYPE, info.getProperty(AUTH_TYPE));
     }
 
     String authorityStr = connParams.getSuppliedURLAuthority();
@@ -510,30 +291,30 @@ public class Utils {
     String newUsage;
     String usageUrlBase = "jdbc:hive2://<host>:<port>/dbName;";
     // Handle deprecation of AUTH_QOP_DEPRECATED
-    newUsage = usageUrlBase + JdbcConnectionParams.AUTH_QOP + "=<qop_value>";
+    newUsage = usageUrlBase + AUTH_QOP + "=<qop_value>";
     handleParamDeprecation(
         connParams.getSessionVars(),
         connParams.getSessionVars(),
-        JdbcConnectionParams.AUTH_QOP_DEPRECATED,
-        JdbcConnectionParams.AUTH_QOP,
+        AUTH_QOP_DEPRECATED,
+        AUTH_QOP,
         newUsage);
 
     // Handle deprecation of TRANSPORT_MODE_DEPRECATED
-    newUsage = usageUrlBase + JdbcConnectionParams.TRANSPORT_MODE + "=<transport_mode_value>";
+    newUsage = usageUrlBase + TRANSPORT_MODE + "=<transport_mode_value>";
     handleParamDeprecation(
         connParams.getHiveConfs(),
         connParams.getSessionVars(),
-        JdbcConnectionParams.TRANSPORT_MODE_DEPRECATED,
-        JdbcConnectionParams.TRANSPORT_MODE,
+        TRANSPORT_MODE_DEPRECATED,
+        TRANSPORT_MODE,
         newUsage);
 
     // Handle deprecation of HTTP_PATH_DEPRECATED
-    newUsage = usageUrlBase + JdbcConnectionParams.HTTP_PATH + "=<http_path_value>";
+    newUsage = usageUrlBase + HTTP_PATH + "=<http_path_value>";
     handleParamDeprecation(
         connParams.getHiveConfs(),
         connParams.getSessionVars(),
-        JdbcConnectionParams.HTTP_PATH_DEPRECATED,
-        JdbcConnectionParams.HTTP_PATH,
+        HTTP_PATH_DEPRECATED,
+        HTTP_PATH,
         newUsage);
   }
 
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/ZooKeeperHiveClientHelper.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/ZooKeeperHiveClientHelper.java
index 2171c142f..c6aad50ae 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/ZooKeeperHiveClientHelper.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/ZooKeeperHiveClientHelper.java
@@ -27,7 +27,6 @@ import java.util.regex.Pattern;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.retry.ExponentialBackoffRetry;
-import org.apache.kyuubi.jdbc.hive.Utils.JdbcConnectionParams;
 
 class ZooKeeperHiveClientHelper {
   // Pattern for key1=value1;key2=value2
@@ -141,7 +140,7 @@ class ZooKeeperHiveClientHelper {
    * Apply configs published by the server. Configs specified from client's JDBC URI override
    * configs published by the server.
    */
-  private static void applyConfs(String serverConfStr, Utils.JdbcConnectionParams connParams)
+  private static void applyConfs(String serverConfStr, JdbcConnectionParams connParams)
       throws Exception {
     Matcher matcher = kvPattern.matcher(serverConfStr);
     while (matcher.find()) {
@@ -157,12 +156,8 @@ class ZooKeeperHiveClientHelper {
         }
         // Set transportMode
         if ((matcher.group(1).equals("hive.server2.transport.mode"))
-            && !(connParams
-                .getSessionVars()
-                .containsKey(Utils.JdbcConnectionParams.TRANSPORT_MODE))) {
-          connParams
-              .getSessionVars()
-              .put(Utils.JdbcConnectionParams.TRANSPORT_MODE, matcher.group(2));
+            && !(connParams.getSessionVars().containsKey(JdbcConnectionParams.TRANSPORT_MODE))) {
+          connParams.getSessionVars().put(JdbcConnectionParams.TRANSPORT_MODE, matcher.group(2));
         }
         // Set port
         if (matcher.group(1).equals("hive.server2.thrift.port")) {
@@ -174,19 +169,19 @@ class ZooKeeperHiveClientHelper {
         }
         // Set sasl qop
         if ((matcher.group(1).equals("hive.server2.thrift.sasl.qop"))
-            && !(connParams.getSessionVars().containsKey(Utils.JdbcConnectionParams.AUTH_QOP))) {
-          connParams.getSessionVars().put(Utils.JdbcConnectionParams.AUTH_QOP, matcher.group(2));
+            && !(connParams.getSessionVars().containsKey(JdbcConnectionParams.AUTH_QOP))) {
+          connParams.getSessionVars().put(JdbcConnectionParams.AUTH_QOP, matcher.group(2));
         }
         // Set http path
         if ((matcher.group(1).equals("hive.server2.thrift.http.path"))
-            && !(connParams.getSessionVars().containsKey(Utils.JdbcConnectionParams.HTTP_PATH))) {
-          connParams.getSessionVars().put(Utils.JdbcConnectionParams.HTTP_PATH, matcher.group(2));
+            && !(connParams.getSessionVars().containsKey(JdbcConnectionParams.HTTP_PATH))) {
+          connParams.getSessionVars().put(JdbcConnectionParams.HTTP_PATH, matcher.group(2));
         }
         // Set SSL
         if ((matcher.group(1) != null)
             && (matcher.group(1).equals("hive.server2.use.SSL"))
-            && !(connParams.getSessionVars().containsKey(Utils.JdbcConnectionParams.USE_SSL))) {
-          connParams.getSessionVars().put(Utils.JdbcConnectionParams.USE_SSL, matcher.group(2));
+            && !(connParams.getSessionVars().containsKey(JdbcConnectionParams.USE_SSL))) {
+          connParams.getSessionVars().put(JdbcConnectionParams.USE_SSL, matcher.group(2));
         }
         /*
          * Note: this is pretty messy, but sticking to the current implementation. Set
@@ -199,24 +194,20 @@ class ZooKeeperHiveClientHelper {
         if (matcher.group(1).equals("hive.server2.authentication")) {
           // NOSASL
           if (matcher.group(2).equalsIgnoreCase("NOSASL")
-              && !(connParams.getSessionVars().containsKey(Utils.JdbcConnectionParams.AUTH_TYPE)
+              && !(connParams.getSessionVars().containsKey(JdbcConnectionParams.AUTH_TYPE)
                   && connParams
                       .getSessionVars()
-                      .get(Utils.JdbcConnectionParams.AUTH_TYPE)
-                      .equalsIgnoreCase(Utils.JdbcConnectionParams.AUTH_SIMPLE))) {
+                      .get(JdbcConnectionParams.AUTH_TYPE)
+                      .equalsIgnoreCase(JdbcConnectionParams.AUTH_SIMPLE))) {
             connParams
                 .getSessionVars()
-                .put(Utils.JdbcConnectionParams.AUTH_TYPE, Utils.JdbcConnectionParams.AUTH_SIMPLE);
+                .put(JdbcConnectionParams.AUTH_TYPE, JdbcConnectionParams.AUTH_SIMPLE);
           }
         }
         // KERBEROS
         if (matcher.group(1).equalsIgnoreCase("hive.server2.authentication.kerberos.principal")
-            && !(connParams
-                .getSessionVars()
-                .containsKey(Utils.JdbcConnectionParams.AUTH_PRINCIPAL))) {
-          connParams
-              .getSessionVars()
-              .put(Utils.JdbcConnectionParams.AUTH_PRINCIPAL, matcher.group(2));
+            && !(connParams.getSessionVars().containsKey(JdbcConnectionParams.AUTH_PRINCIPAL))) {
+          connParams.getSessionVars().put(JdbcConnectionParams.AUTH_PRINCIPAL, matcher.group(2));
         }
       }
     }
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveBaseChar.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveBaseChar.java
deleted file mode 100644
index 30e0003ce..000000000
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveBaseChar.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.kyuubi.jdbc.hive.common;
-
-import org.apache.commons.lang3.StringUtils;
-
-public abstract class HiveBaseChar {
-  protected String value;
-
-  protected HiveBaseChar() {}
-
-  /**
-   * Sets the string value to a new value, obeying the max length defined for this object.
-   *
-   * @param val new value
-   */
-  public void setValue(String val, int maxLength) {
-    value = HiveBaseChar.enforceMaxLength(val, maxLength);
-  }
-
-  public void setValue(HiveBaseChar val, int maxLength) {
-    setValue(val.value, maxLength);
-  }
-
-  public static String enforceMaxLength(String val, int maxLength) {
-    if (val == null) {
-      return null;
-    }
-    String value = val;
-
-    if (maxLength > 0) {
-      int valLength = val.codePointCount(0, val.length());
-      if (valLength > maxLength) {
-        // Truncate the excess chars to fit the character length.
-        // Also make sure we take supplementary chars into account.
-        value = val.substring(0, val.offsetByCodePoints(0, maxLength));
-      }
-    }
-    return value;
-  }
-
-  public static String getPaddedValue(String val, int maxLength) {
-    if (val == null) {
-      return null;
-    }
-    if (maxLength < 0) {
-      return val;
-    }
-
-    int valLength = val.codePointCount(0, val.length());
-    if (valLength > maxLength) {
-      return enforceMaxLength(val, maxLength);
-    }
-
-    if (maxLength > valLength) {
-      // Make sure we pad the right amount of spaces; valLength is in terms of code points,
-      // while StringUtils.rpad() is based on the number of java chars.
-      int padLength = val.length() + (maxLength - valLength);
-      val = StringUtils.rightPad(val, padLength);
-    }
-    return val;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public int getCharacterLength() {
-    return value.codePointCount(0, value.length());
-  }
-
-  @Override
-  public int hashCode() {
-    return getValue().hashCode();
-  }
-
-  @Override
-  public String toString() {
-    return getValue();
-  }
-}
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveChar.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveChar.java
deleted file mode 100644
index cdebd5c8c..000000000
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveChar.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.kyuubi.jdbc.hive.common;
-
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * HiveChar. String values will be padded to full char length. Character legnth, comparison,
- * hashCode should ignore trailing spaces.
- */
-public class HiveChar extends HiveBaseChar implements Comparable<HiveChar> {
-
-  public static final int MAX_CHAR_LENGTH = 255;
-
-  public HiveChar() {}
-
-  public HiveChar(String val, int len) {
-    setValue(val, len);
-  }
-
-  public HiveChar(HiveChar hc, int len) {
-    setValue(hc.value, len);
-  }
-
-  /** Set char value, padding or truncating the value to the size of len parameter. */
-  public void setValue(String val, int len) {
-    super.setValue(HiveBaseChar.getPaddedValue(val, len), -1);
-  }
-
-  public void setValue(String val) {
-    setValue(val, -1);
-  }
-
-  public String getStrippedValue() {
-    return StringUtils.stripEnd(value, " ");
-  }
-
-  public String getPaddedValue() {
-    return value;
-  }
-
-  public int getCharacterLength() {
-    String strippedValue = getStrippedValue();
-    return strippedValue.codePointCount(0, strippedValue.length());
-  }
-
-  public String toString() {
-    return getPaddedValue();
-  }
-
-  public int compareTo(HiveChar rhs) {
-    if (rhs == this) {
-      return 0;
-    }
-    return this.getStrippedValue().compareTo(rhs.getStrippedValue());
-  }
-
-  public boolean equals(Object rhs) {
-    if (rhs == this) {
-      return true;
-    }
-    if (rhs == null || rhs.getClass() != getClass()) {
-      return false;
-    }
-    return this.getStrippedValue().equals(((HiveChar) rhs).getStrippedValue());
-  }
-
-  public int hashCode() {
-    return getStrippedValue().hashCode();
-  }
-}
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveVarchar.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveVarchar.java
deleted file mode 100644
index 6204c58b0..000000000
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/HiveVarchar.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.kyuubi.jdbc.hive.common;
-
-/** HiveVarChar. String wrapper to support SQL VARCHAR features. Max string length is enforced. */
-public class HiveVarchar extends HiveBaseChar implements Comparable<HiveVarchar> {
-
-  public static final int MAX_VARCHAR_LENGTH = 65535;
-
-  public HiveVarchar() {}
-
-  public HiveVarchar(String val, int len) {
-    setValue(val, len);
-  }
-
-  public HiveVarchar(HiveVarchar hc, int len) {
-    setValue(hc, len);
-  }
-
-  /** Set the new value */
-  public void setValue(String val) {
-    super.setValue(val, -1);
-  }
-
-  public void setValue(HiveVarchar hc) {
-    super.setValue(hc.getValue(), -1);
-  }
-
-  public int compareTo(HiveVarchar rhs) {
-    if (rhs == this) {
-      return 0;
-    }
-    return this.getValue().compareTo(rhs.getValue());
-  }
-
-  public boolean equals(Object rhs) {
-    if (rhs == this) {
-      return true;
-    }
-    return this.getValue().equals(((HiveVarchar) rhs).getValue());
-  }
-}
diff --git a/kyuubi-hive-jdbc/src/test/java/org/apache/kyuubi/jdbc/hive/UtilsTest.java b/kyuubi-hive-jdbc/src/test/java/org/apache/kyuubi/jdbc/hive/UtilsTest.java
index 434e79cf7..c87b463c3 100644
--- a/kyuubi-hive-jdbc/src/test/java/org/apache/kyuubi/jdbc/hive/UtilsTest.java
+++ b/kyuubi-hive-jdbc/src/test/java/org/apache/kyuubi/jdbc/hive/UtilsTest.java
@@ -18,7 +18,6 @@
 
 package org.apache.kyuubi.jdbc.hive;
 
-import static org.apache.kyuubi.jdbc.hive.Utils.JdbcConnectionParams;
 import static org.apache.kyuubi.jdbc.hive.Utils.extractURLComponents;
 import static org.junit.Assert.assertEquals;