thomasrebele commented on code in PR #6727:
URL: https://github.com/apache/hive/pull/6727#discussion_r3957498692


##########
jdbc-handler/src/main/java/org/apache/hive/storage/jdbc/JdbcStorageHandler.java:
##########
@@ -107,10 +111,20 @@ public URI getURIForAuth(Table table) throws 
URISyntaxException {
     Map<String, String> tableProperties = 
HiveCustomStorageHandlerUtils.getTableProperties(table);
     DatabaseType dbType = DatabaseType.valueOf(
       tableProperties.get(JdbcStorageConfig.DATABASE_TYPE.getPropertyName()));
-    String host_url = DatabaseType.METASTORE == dbType ?
+    String hostUrl = DatabaseType.METASTORE == dbType ?
       "jdbc:metastore://" : tableProperties.get(Constants.JDBC_URL);
-    String table_name = tableProperties.get(Constants.JDBC_TABLE);
-    return new URI(host_url+"/"+table_name);
+    // Encode only the auth-resource path segment to keep URI construction 
valid; this does not
+    // alter the JDBC URL used by the driver for actual query execution.
+    String tableName = 
encodeIdentifierForAuth(tableProperties.get(Constants.JDBC_TABLE));
+    return new URI(hostUrl + "/" + tableName);
+  }
+
+  private static String encodeIdentifierForAuth(String identifier) {
+    String physical = unquoteJdbcIdentifier(identifier);
+    if (physical == null) {
+      return null;

Review Comment:
   Throwing an exception seems to have broken 
TestInformationSchemaWithPrivilegeZookeeperPlain.test and 
TestInformationSchemaWithPrivilegeZookeeperSSL.test.
   
   The method JdbcStorageHandler#getURIForAuth is used for metastore tables as 
well (e.g., `BUCKETING_COLS`), but the table properties do not define JDBC_URL 
nor JDBC_TABLE. I guess the easiest fix would be to not throw an exception. 
Wdyt, @soumyakanti3578?



-- 
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]

Reply via email to