[ https://issues.apache.org/jira/browse/HIVE-24853?focusedWorklogId=563949&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-563949 ]
ASF GitHub Bot logged work on HIVE-24853: ----------------------------------------- Author: ASF GitHub Bot Created on: 10/Mar/21 18:16 Start Date: 10/Mar/21 18:16 Worklog Time Spent: 10m Work Description: ayushtkn commented on a change in pull request #2044: URL: https://github.com/apache/hive/pull/2044#discussion_r591758640 ########## File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java ########## @@ -1802,57 +1808,73 @@ private long partsFoundForPartitions( + " and \"ENGINE\" = ? " + " group by \"COLUMN_NAME\", \"COLUMN_TYPE\""; start = doTrace ? System.nanoTime() : 0; - query = pm.newQuery("javax.jdo.query.SQL", queryText); - qResult = executeWithArray(query, prepareParams(catName, dbName, tableName, partNames, colNames, engine), - queryText); - end = doTrace ? System.nanoTime() : 0; - MetastoreDirectSqlUtils.timingTrace(doTrace, queryText, start, end); - if (qResult == null) { - query.closeAll(); - return Collections.emptyList(); - } List<String> noExtraColumnNames = new ArrayList<String>(); Map<String, String[]> extraColumnNameTypeParts = new HashMap<String, String[]>(); - List<Object[]> list = MetastoreDirectSqlUtils.ensureList(qResult); - for (Object[] row : list) { - String colName = (String) row[0]; - String colType = (String) row[1]; - // Extrapolation is not needed for this column if - // count(\"PARTITION_NAME\")==partNames.size() - // Or, extrapolation is not possible for this column if - // count(\"PARTITION_NAME\")<2 - Long count = MetastoreDirectSqlUtils.extractSqlLong(row[2]); - if (count == partNames.size() || count < 2) { - noExtraColumnNames.add(colName); - } else { - extraColumnNameTypeParts.put(colName, new String[] { colType, String.valueOf(count) }); + try(Query query = pm.newQuery("javax.jdo.query.SQL", queryText);) { + qResult = executeWithArray(query, + prepareParams(catName, dbName, tableName, partNames, colNames, + engine), queryText); + end = doTrace ? System.nanoTime() : 0; + MetastoreDirectSqlUtils.timingTrace(doTrace, queryText, start, end); + if (qResult == null) { + query.closeAll(); + return Collections.emptyList(); + } + + List<Object[]> list = MetastoreDirectSqlUtils.ensureList(qResult); + for (Object[] row : list) { + String colName = (String) row[0]; + String colType = (String) row[1]; + // Extrapolation is not needed for this column if + // count(\"PARTITION_NAME\")==partNames.size() + // Or, extrapolation is not possible for this column if + // count(\"PARTITION_NAME\")<2 + Long count = MetastoreDirectSqlUtils.extractSqlLong(row[2]); + if (count == partNames.size() || count < 2) { + noExtraColumnNames.add(colName); + } else { + extraColumnNameTypeParts + .put(colName, new String[] {colType, String.valueOf(count)}); + } + Deadline.checkTimeout(); + } + } catch (Exception e) { + if (e instanceof MetaException) { + throw (MetaException) e; } - Deadline.checkTimeout(); } - query.closeAll(); // Extrapolation is not needed for columns noExtraColumnNames Review comment: Isn't that only being done here? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 563949) Time Spent: 1h 50m (was: 1h 40m) > HMS leaks queries in case of timeout > ------------------------------------ > > Key: HIVE-24853 > URL: https://issues.apache.org/jira/browse/HIVE-24853 > Project: Hive > Issue Type: Bug > Reporter: Ayush Saxena > Assignee: Ayush Saxena > Priority: Major > Labels: pull-request-available > Time Spent: 1h 50m > Remaining Estimate: 0h > > The queries aren't closed in case of timeout. -- This message was sent by Atlassian Jira (v8.3.4#803005)