[ https://issues.apache.org/jira/browse/HIVE-26666?focusedWorklogId=825666&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-825666 ]
ASF GitHub Bot logged work on HIVE-26666: ----------------------------------------- Author: ASF GitHub Bot Created on: 14/Nov/22 08:42 Start Date: 14/Nov/22 08:42 Worklog Time Spent: 10m Work Description: rkirtir commented on code in PR #3712: URL: https://github.com/apache/hive/pull/3712#discussion_r1021211308 ########## ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/compact/AlterTableCompactOperation.java: ########## @@ -126,16 +126,11 @@ private void waitForCompactionToFinish(CompactionResponse resp) throws HiveExcep context.getConsole().printInfo("Interrupted while waiting for compaction with id=" + resp.getId()); break; } - - //this could be expensive when there are a lot of compactions.... - //todo: update to search by ID once HIVE-13353 is done - ShowCompactResponse allCompactions = context.getDb().showCompactions(); - for (ShowCompactResponseElement compaction : allCompactions.getCompacts()) { - if (resp.getId() != compaction.getId()) { - continue; - } - - switch (compaction.getState()) { + ShowCompactRequest request = new ShowCompactRequest(); + request.setId(resp.getId()); + ShowCompactResponse compaction = context.getDb().showCompactions(request); + if (compaction.getCompactsSize() == 1) { + switch (compaction.getCompacts().get(0).getState()) { Review Comment: done ########## ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/compact/AlterTableCompactOperation.java: ########## @@ -126,16 +126,11 @@ private void waitForCompactionToFinish(CompactionResponse resp) throws HiveExcep context.getConsole().printInfo("Interrupted while waiting for compaction with id=" + resp.getId()); break; } - - //this could be expensive when there are a lot of compactions.... - //todo: update to search by ID once HIVE-13353 is done - ShowCompactResponse allCompactions = context.getDb().showCompactions(); - for (ShowCompactResponseElement compaction : allCompactions.getCompacts()) { - if (resp.getId() != compaction.getId()) { - continue; - } - - switch (compaction.getState()) { + ShowCompactRequest request = new ShowCompactRequest(); Review Comment: done Issue Time Tracking ------------------- Worklog Id: (was: 825666) Time Spent: 2h 20m (was: 2h 10m) > Filter out compactions by id to minimise expense of db operations > ------------------------------------------------------------------ > > Key: HIVE-26666 > URL: https://issues.apache.org/jira/browse/HIVE-26666 > Project: Hive > Issue Type: Improvement > Affects Versions: 4.0.0 > Reporter: KIRTI RUGE > Assignee: KIRTI RUGE > Priority: Major > Labels: pull-request-available > Fix For: 4.0.0 > > Time Spent: 2h 20m > Remaining Estimate: 0h > > At present we use below operations while filtering out compactions in classes > like > AlterTableCompactOperation > cleaner > Use show compaction filter option provided after > https://issues.apache.org/jira/browse/HIVE-13353 -- This message was sent by Atlassian Jira (v8.20.10#820010)