[ 
https://issues.apache.org/jira/browse/HIVE-13353?focusedWorklogId=815091&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-815091
 ]

ASF GitHub Bot logged work on HIVE-13353:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Oct/22 03:56
            Start Date: 10/Oct/22 03:56
    Worklog Time Spent: 10m 
      Work Description: rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r990899289


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +83,71 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) 
throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (desc.getDbName() == null && desc.getTbName() != null) {
+      request.setDbname(SessionState.get().getCurrentDatabase());
+    } else {
+      request.setDbname(desc.getDbName());
+    }
+    if (desc.getTbName() != null && !desc.getTbName().isEmpty())
+      request.setTablename(desc.getTbName());
+    if (desc.getPoolName() != null && !desc.getPoolName().isEmpty())
+      request.setPoolName(desc.getPoolName());
+    if (desc.getCompactionType() != null && 
!desc.getCompactionType().isEmpty())
+      request.setType(inputCompactionType2DBType(desc.getCompactionType()));
+    if (desc.getCompactionStatus() != null && 
!desc.getCompactionStatus().isEmpty())
+      request.setState(compactorStateFromInput(desc.getCompactionStatus()));
+    if (desc.getPartSpec() != null && !desc.getPartSpec().isEmpty())
+      request.setPartitionname(getPartitionName(desc.getPartSpec()));
+    return request;
+  }
+
+  private String getPartitionName(Map<String, String> partitionSpec) throws 
SemanticException {
+    String partitionName = null;
+    if (partitionSpec != null) {
+      try {
+        partitionName = Warehouse.makePartName(partitionSpec, false);
+      } catch (MetaException e) {
+        throw new SemanticException("partition " + partitionSpec.toString() + 
" not found");
+      }
+    }
+    return partitionName;
+  }
+
+  static CompactionType inputCompactionType2DBType(String inputValue) throws 
MetaException {

Review Comment:
   Agree. Addressing the same





Issue Time Tracking
-------------------

    Worklog Id:     (was: 815091)
    Time Spent: 2.5h  (was: 2h 20m)

> SHOW COMPACTIONS should support filtering options
> -------------------------------------------------
>
>                 Key: HIVE-13353
>                 URL: https://issues.apache.org/jira/browse/HIVE-13353
>             Project: Hive
>          Issue Type: Improvement
>          Components: Transactions
>    Affects Versions: 1.3.0, 2.0.0
>            Reporter: Eugene Koifman
>            Assignee: KIRTI RUGE
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-13353.01.patch
>
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> Since we now have historical information in SHOW COMPACTIONS the output can 
> easily become unwieldy. (e.g. 1000 partitions with 3 lines of history each)
> this is a significant usability issue
> Need to add ability to filter by db/table/partition
> Perhaps would also be useful to filter by status



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to