You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/10/05 00:30:23 UTC

[GitHub] [hive] dengzhhu653 commented on a change in pull request #2344: HIVE-23633: Metastore some JDO query objects do not close …

dengzhhu653 commented on a change in pull request #2344:
URL: https://github.com/apache/hive/pull/2344#discussion_r721803993



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
##########
@@ -368,20 +363,22 @@ private void executeNoResult(final String queryText) throws SQLException {
   }
 
   public Database getDatabase(String catName, String dbName) throws MetaException{
-    Query queryDbSelector = null;
-    Query queryDbParams = null;
-    try {
+    String queryTextDbSelector= "select "
+        + "\"DB_ID\", \"NAME\", \"DB_LOCATION_URI\", \"DESC\", "
+        + "\"OWNER_NAME\", \"OWNER_TYPE\", \"CTLG_NAME\" , \"CREATE_TIME\", \"DB_MANAGED_LOCATION_URI\", "
+        + "\"TYPE\", \"DATACONNECTOR_NAME\", \"REMOTE_DBNAME\""
+        + "FROM "+ DBS
+        + " where \"NAME\" = ? and \"CTLG_NAME\" = ? ";
+    String queryTextDbParams = "select \"PARAM_KEY\", \"PARAM_VALUE\" "
+        + " from " + DATABASE_PARAMS + " "
+        + " WHERE \"DB_ID\" = ? "
+        + " AND \"PARAM_KEY\" IS NOT NULL";

Review comment:
       Thank you for the review, @belugabehr!  My idea is to make the codes be clean and the same pattern by replacing the standalone `close` to try-with-resource.




-- 
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-unsubscribe@hive.apache.org

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



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