private String encodeString(String rawString) {
    if (rawString == null) {
      return null;
    }
    if (HiveConf.getBoolVar(jobConf, HIVE_SECURITY_HBASE_URLENCODE_AUTHORIZATION_URI)) {
      return HiveConf.EncoderDecoderFactory.URL_ENCODER_DECODER.encode(rawString);
    } else {
      return rawString.replace("#", "%23");
    }
  }
HBase config for determining the client port based on hbase-site.xml
hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStorageHandler.java