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

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

                Author: ASF GitHub Bot
            Created on: 17/Jan/23 10:17
            Start Date: 17/Jan/23 10:17
    Worklog Time Spent: 10m 
      Work Description: rkirtir commented on code in PR #3880:
URL: https://github.com/apache/hive/pull/3880#discussion_r1072022432


##########
standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift:
##########
@@ -1393,6 +1393,22 @@ struct ShowCompactResponse {
     1: required list<ShowCompactResponseElement> compacts,
 }
 
+struct AbortCompactionRequest {
+    1: required list<i64> compactionIds,
+    2: optional string type,
+    3: optional string poolName
+}
+
+struct AbortCompactionResponseElement {
+    1: required i64 compactionIds,

Review Comment:
   fixed



##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/abort/compaction/AbortCompactionsOperation.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.ddl.process.abort.compaction;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.metastore.api.AbortCompactResponse;
+import org.apache.hadoop.hive.metastore.api.AbortCompactionRequest;
+import org.apache.hadoop.hive.metastore.api.AbortCompactionResponseElement;
+import org.apache.hadoop.hive.ql.ddl.DDLOperation;
+import org.apache.hadoop.hive.ql.ddl.DDLOperationContext;
+import org.apache.hadoop.hive.ql.ddl.ShowUtils;
+import org.apache.hadoop.hive.ql.exec.Utilities;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+
+/**
+ * Operation process of aborting compactions.
+ */
+public class AbortCompactionsOperation extends 
DDLOperation<AbortCompactionsDesc> {
+    public AbortCompactionsOperation(DDLOperationContext context, 
AbortCompactionsDesc desc) {
+        super(context, desc);
+    }
+
+    @Override
+    public int execute() throws HiveException {
+        AbortCompactionRequest request = new AbortCompactionRequest();
+        request.setCompactionIds(desc.getCompactionIds());
+        AbortCompactResponse response = 
context.getDb().abortCompactions(request);
+        try (DataOutputStream os = ShowUtils.getOutputStream(new 
Path(desc.getResFile()), context)) {
+            writeHeader(os);
+            if (response.getAbortedcompacts() != null) {
+                for (AbortCompactionResponseElement e : 
response.getAbortedcompacts()) {
+                    writeRow(os, e);
+                }
+            }
+        } catch (Exception e) {
+            LOG.warn("show compactions: ", e);

Review Comment:
   fixed





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

    Worklog Id:     (was: 839567)
    Time Spent: 1h  (was: 50m)

> Cancel Compactions in initiated state
> -------------------------------------
>
>                 Key: HIVE-26804
>                 URL: https://issues.apache.org/jira/browse/HIVE-26804
>             Project: Hive
>          Issue Type: New Feature
>          Components: Hive
>            Reporter: KIRTI RUGE
>            Assignee: KIRTI RUGE
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h
>  Remaining Estimate: 0h
>




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

Reply via email to