pvargacl commented on a change in pull request #1693:
URL: https://github.com/apache/hive/pull/1693#discussion_r528777347



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -590,6 +587,39 @@ public Object run() throws Exception {
     return true;
   }
 
+  private void failCompactionIfSetForTest() {
+    if(conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST) && 
conf.getBoolVar(HiveConf.ConfVars.HIVETESTMODEFAILCOMPACTION)) {
+      throw new 
RuntimeException(HiveConf.ConfVars.HIVETESTMODEFAILCOMPACTION.name() + "=true");
+    }
+  }
+
+  private void runCompactionViaMrJob(CompactionInfo ci, Table t, Partition p, 
StorageDescriptor sd,
+      ValidCompactorWriteIdList tblValidWriteIds, StringBuilder jobName, 
AcidUtils.Directory dir, StatsUpdater su)
+      throws IOException, HiveException, InterruptedException {
+    final CompactorMR mr = new CompactorMR();
+    if (runJobAsSelf(ci.runAs)) {
+      mr.run(conf, jobName.toString(), t, p, sd, tblValidWriteIds, ci, su, 
msc, dir);
+    } else {
+      UserGroupInformation ugi = UserGroupInformation.createProxyUser(ci.runAs,
+          UserGroupInformation.getLoginUser());
+      final Partition fp = p;
+      final CompactionInfo fci = ci;
+      ugi.doAs(new PrivilegedExceptionAction<Object>() {

Review comment:
       You can use lambda like this:
   ugi.doAs((PrivilegedExceptionAction<Object>) () -> {
               mr.run(conf, jobName.toString(), t, fp, sd, tblValidWriteIds, 
fci, su, msc, dir);
               return null;
             });




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

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