soumyakanti3578 commented on a change in pull request #1317: URL: https://github.com/apache/hive/pull/1317#discussion_r463036109
########## File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java ########## @@ -3665,33 +3678,39 @@ public boolean dropPartition(String dbName, String tableName, List<String> parti * @return list of partition objects */ public List<Partition> getPartitions(Table tbl) throws HiveException { - if (tbl.isPartitioned()) { - List<org.apache.hadoop.hive.metastore.api.Partition> tParts; - try { - GetPartitionsPsWithAuthRequest req = new GetPartitionsPsWithAuthRequest(); - req.setTblName(tbl.getTableName()); - req.setDbName(tbl.getDbName()); - req.setUserName(getUserName()); - req.setMaxParts((short) -1); - req.setGroupNames(getGroupNames()); - if (AcidUtils.isTransactionalTable(tbl)) { - ValidWriteIdList validWriteIdList = getValidWriteIdList(tbl.getDbName(), tbl.getTableName()); - req.setValidWriteIdList(validWriteIdList != null ? validWriteIdList.toString() : null); - } - GetPartitionsPsWithAuthResponse res = getMSC().listPartitionsWithAuthInfoRequest(req); - tParts = res.getPartitions(); + long t1 = System.nanoTime(); + try { + if (tbl.isPartitioned()) { + List<org.apache.hadoop.hive.metastore.api.Partition> tParts; + try { + GetPartitionsPsWithAuthRequest req = new GetPartitionsPsWithAuthRequest(); + req.setTblName(tbl.getTableName()); + req.setDbName(tbl.getDbName()); + req.setUserName(getUserName()); + req.setMaxParts((short) -1); + req.setGroupNames(getGroupNames()); + if (AcidUtils.isTransactionalTable(tbl)) { + ValidWriteIdList validWriteIdList = getValidWriteIdList(tbl.getDbName(), tbl.getTableName()); + req.setValidWriteIdList(validWriteIdList != null ? validWriteIdList.toString() : null); + } + GetPartitionsPsWithAuthResponse res = getMSC().listPartitionsWithAuthInfoRequest(req); + tParts = res.getPartitions(); - } catch (Exception e) { - LOG.error(StringUtils.stringifyException(e)); - throw new HiveException(e); - } - List<Partition> parts = new ArrayList<>(tParts.size()); - for (org.apache.hadoop.hive.metastore.api.Partition tpart : tParts) { - parts.add(new Partition(tbl, tpart)); + } catch (Exception e) { + LOG.error(StringUtils.stringifyException(e)); + throw new HiveException(e); + } + List<Partition> parts = new ArrayList<>(tParts.size()); + for (org.apache.hadoop.hive.metastore.api.Partition tpart : tParts) { + parts.add(new Partition(tbl, tpart)); + } + return parts; + } else { + return Collections.singletonList(new Partition(tbl)); } - return parts; - } else { - return Collections.singletonList(new Partition(tbl)); + } finally { Review comment: Since there are many instances for 2., I am moving all `PerfLogEnd` to `finally` block for now, which will probably be easier to maintain in the future, because of uniformity. ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org