veghlaci05 commented on code in PR #3513:
URL: https://github.com/apache/hive/pull/3513#discussion_r949938442


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/compact/AlterTableCompactOperation.java:
##########
@@ -90,8 +94,23 @@ private String getPartitionName(Table table) throws 
HiveException {
   }
 
   private CompactionResponse compact(Table table, String partitionName) throws 
HiveException {
-    CompactionResponse resp = context.getDb().compact2(table.getDbName(), 
table.getTableName(), partitionName,
-        desc.getCompactionType(), desc.getProperties());
+    CompactionType compactionType = null;
+    String strType = desc.getCompactionType();
+    if ("major".equalsIgnoreCase(strType)) {
+      compactionType = CompactionType.MAJOR;
+    } else if ("minor".equalsIgnoreCase(strType)) {
+      compactionType = CompactionType.MINOR;
+    } else {
+      throw new RuntimeException("Unknown compaction type " + strType);
+    }
+
+    CompactionRequest req = new CompactionRequest(table.getDbName(), 
table.getTableName(), compactionType);
+    req.setPartitionname(partitionName);
+    req.setPoolName(desc.getPoolName());
+    req.setProperties(desc.getProperties());
+    req.setInitiatorId(JavaUtils.hostname() + "-" + 
HiveMetaStoreClient.MANUALLY_INITIATED_COMPACTION);
+    
req.setInitiatorVersion(HiveMetaStoreClient.class.getPackage().getImplementationVersion());
+    CompactionResponse resp = context.getDb().compact3(req);

Review Comment:
   The code contains both compact and compact2 methods. For backward 
compatibility reasons, I created a new method instead of chanigng the signature 
of an existing one.



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