difin commented on code in PR #4855:
URL: https://github.com/apache/hive/pull/4855#discussion_r1421104824


##########
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/ACIDCompactionExecutor.java:
##########
@@ -0,0 +1,267 @@
+/*
+ * 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.txn.compactor;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.common.ValidCompactorWriteIdList;
+import org.apache.hadoop.hive.common.ValidTxnList;
+import org.apache.hadoop.hive.common.ValidWriteIdList;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.IMetaStoreClient;
+import org.apache.hadoop.hive.metastore.api.CompactionType;
+import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
+import org.apache.hadoop.hive.metastore.api.Table;
+import org.apache.hadoop.hive.metastore.metrics.AcidMetricService;
+import org.apache.hadoop.hive.metastore.txn.CompactionInfo;
+import org.apache.hadoop.hive.metastore.txn.TxnUtils;
+import org.apache.hadoop.hive.ql.Driver;
+import org.apache.hadoop.hive.ql.io.AcidDirectory;
+import org.apache.hadoop.hive.ql.io.AcidUtils;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hive.common.util.Ref;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Collections;
+
+public class ACIDCompactionExecutor implements CompactionExecutor {
+  static final private String CLASS_NAME = Worker.class.getName();
+  static final private Logger LOG = LoggerFactory.getLogger(CLASS_NAME);
+
+  private final Worker worker;
+  private final IMetaStoreClient msc;
+  private final HiveConf conf;
+  private final CompactionInfo ci;
+  private final Table table;
+  private final boolean collectGenericStats;
+  private final boolean collectMrStats;
+  private final Worker.CompactionTxn compactionTxn;
+
+  public ACIDCompactionExecutor(Worker worker, CompactionInfo ci, 
Worker.CompactionTxn compactionTxn,

Review Comment:
   Hi @deniskuzZ,
   I did the refactoring, moved the common methods into a separate common class 
and got rid of the Worker in CompactionExecutors. I moved all the common 
compaction methods into CompactionUtil class.
   I think the best location for all the common compaction methods is not in 
the TaskHandler, but in the CompactionUtil because CompactionUtil already 
contained several duplicated methods which were also present in CompactorThread 
and TaskHandler is just another client of CompactionUtil which uses many 
methods from there, like CompactorThread also does.
   I refactored TaskHandler too and made it use resolvePartition method from 
CompactionUtil were I moved it from CompactorThread. 
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to