[
https://issues.apache.org/jira/browse/HIVE-26666?focusedWorklogId=825189&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-825189
]
ASF GitHub Bot logged work on HIVE-26666:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 11/Nov/22 08:16
Start Date: 11/Nov/22 08:16
Worklog Time Spent: 10m
Work Description: deniskuzZ commented on code in PR #3712:
URL: https://github.com/apache/hive/pull/3712#discussion_r1019978889
##########
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:
please create a local var for `compaction.getCompacts().get(0)`
Issue Time Tracking
-------------------
Worklog Id: (was: 825189)
Time Spent: 1h 40m (was: 1.5h)
> 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: 1h 40m
> 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)