ayushtkn commented on code in PR #5554:
URL: https://github.com/apache/hive/pull/5554#discussion_r1878532349


##########
jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java:
##########
@@ -744,12 +744,16 @@ public <T> T getObject(int columnIndex, Class<T> type) 
throws SQLException {
     };
   }
 
-  public String getURL() throws SQLException {
-    throw new SQLFeatureNotSupportedException("Method not supported");
+  public String getURL() {
+    return connection.getConnectedUrl();
   }
 
   public String getUserName() throws SQLException {
-    throw new SQLFeatureNotSupportedException("Method not supported");
+    String userName = 
connection.getConnParams().getSessionVars().get(JdbcConnectionParams.AUTH_USER);
+    if ((userName == null) || userName.isEmpty()) {
+      userName = JdbcConnectionParams.ANONYMOUS_USER;
+    }
+    return userName;
   }

Review Comment:
   can we just do
   ```
     public String getUserName() throws SQLException {
       return connection.getUserName();
     }
   ```
   
   and make ``getUserName()`` in ``HiveConnection`` package-private (default)?



##########
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestHiveDatabaseMetaData.java:
##########
@@ -18,18 +18,15 @@
 
 package org.apache.hive.jdbc;
 
-import org.apache.hive.jdbc.HiveConnection;
-import org.apache.hive.jdbc.Utils;
+import com.google.common.collect.ImmutableMap;
 import org.apache.hive.jdbc.Utils.JdbcConnectionParams;
+import org.junit.Before;
+import org.junit.Test;
 
+import java.sql.SQLException;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
-import java.util.Properties;
 import java.util.Map;
-import java.util.HashMap;
-import java.sql.SQLException;
-
-import org.junit.Before;
-import org.junit.Test;

Review Comment:
   Can you just avoid changing the import order, just makes things complicated 
while backporting



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to