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 8a8e03d  HIVE-25626: CBO fails when JDBC table specifies password via 
dbcp.password.uri (Chiran Ravani, reviewed by Stamatis Zampetakis)
8a8e03d is described below

commit 8a8e03d02003aa3543f46f595b4425fd8c156ad9
Author: cravani <[email protected]>
AuthorDate: Tue Oct 19 22:54:50 2021 -0400

    HIVE-25626: CBO fails when JDBC table specifies password via 
dbcp.password.uri (Chiran Ravani, reviewed by Stamatis Zampetakis)
    
    1. Include hive.sql.dbcp.password.uri property when looking for
    passwords in CalcitePlanner.
    2. Align order of obtaining JDBC password in CalcitePlanner with
    JdbcStorageConfigManager.
    
    Closes #2734
---
 .../java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
index e6ae265..2d50eb6 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
@@ -3013,11 +3013,18 @@ public class CalcitePlanner extends SemanticAnalyzer {
             final String url = tabMetaData.getProperty(Constants.JDBC_URL);
             final String driver = 
tabMetaData.getProperty(Constants.JDBC_DRIVER);
             final String user = 
tabMetaData.getProperty(Constants.JDBC_USERNAME);
-            String pswd = tabMetaData.getProperty(Constants.JDBC_PASSWORD);
-            if (pswd == null) {
+            final String pswd;
+            if (tabMetaData.getProperty(Constants.JDBC_PASSWORD) != null) {
+              pswd = tabMetaData.getProperty(Constants.JDBC_PASSWORD);
+            } else if (tabMetaData.getProperty(Constants.JDBC_KEYSTORE) != 
null) {
               String keystore = 
tabMetaData.getProperty(Constants.JDBC_KEYSTORE);
               String key = tabMetaData.getProperty(Constants.JDBC_KEY);
               pswd = Utilities.getPasswdFromKeystore(keystore, key);
+            } else if (tabMetaData.getProperty(Constants.JDBC_PASSWORD_URI) != 
null) {
+              pswd = 
Utilities.getPasswdFromUri(tabMetaData.getProperty(Constants.JDBC_PASSWORD_URI));
+            } else {
+              pswd = null;
+              LOG.warn("No password found for accessing {} table via JDBC", 
fullyQualifiedTabName);
             }
             final String catalogName = 
tabMetaData.getProperty(Constants.JDBC_CATALOG);
             final String schemaName = 
tabMetaData.getProperty(Constants.JDBC_SCHEMA);

Reply via email to