kishendas commented on a change in pull request #1217:
URL: https://github.com/apache/hive/pull/1217#discussion_r451058731



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##########
@@ -3580,7 +3592,19 @@ public boolean dropPartition(String dbName, String 
tableName, List<String> parti
     List<String> pvals = MetaStoreUtils.getPvals(t.getPartCols(), partSpec);
 
     try {
-      names = getMSC().listPartitionNames(dbName, tblName, pvals, max);
+      if (AcidUtils.isTransactionalTable(t)) {
+        GetPartitionNamesPsRequest req = new GetPartitionNamesPsRequest();
+        req.setTblName(tblName);
+        req.setDbName(dbName);
+        req.setPartValues(pvals);
+        req.setMaxParts(max);
+        ValidWriteIdList validWriteIdList = getValidWriteIdList(dbName, 
tblName);
+        req.setValidWriteIdList(validWriteIdList != null ? 
validWriteIdList.toString() : null);
+        GetPartitionNamesPsResponse res = 
getMSC().listPartitionNamesRequest(req);
+        names = res.getNames();
+      } else {
+        names = getMSC().listPartitionNames(dbName, tblName, pvals, max);

Review comment:
       Makes sense, done. 

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##########
@@ -3602,9 +3626,27 @@ public boolean dropPartition(String dbName, String 
tableName, List<String> parti
       exprBytes = SerializationUtilities.serializeExpressionToKryo(expr);
     }
     try {
+
       String defaultPartitionName = HiveConf.getVar(conf, 
ConfVars.DEFAULTPARTITIONNAME);
-      names = getMSC().listPartitionNames(tbl.getCatalogName(), 
tbl.getDbName(),
-          tbl.getTableName(), defaultPartitionName, exprBytes, order, 
maxParts);
+
+      if (AcidUtils.isTransactionalTable(tbl)) {
+        PartitionsByExprRequest req =
+            new PartitionsByExprRequest(tbl.getDbName(), tbl.getTableName(), 
ByteBuffer.wrap(exprBytes));
+        req.setDefaultPartitionName(defaultPartitionName);
+        if (maxParts >= 0) {
+          req.setMaxParts(maxParts);
+        }
+        req.setOrder(order);
+        req.setCatName(tbl.getCatalogName());
+        ValidWriteIdList validWriteIdList = 
getValidWriteIdList(tbl.getDbName(), tbl.getTableName());
+        req.setValidWriteIdList(validWriteIdList != null ? 
validWriteIdList.toString() : null);
+        names = getMSC().listPartitionNames(req);
+
+      } else {
+        names = getMSC()
+            .listPartitionNames(tbl.getCatalogName(), tbl.getDbName(), 
tbl.getTableName(), defaultPartitionName,

Review comment:
       Makes sense, done. 

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##########
@@ -3917,12 +3972,26 @@ public boolean dropPartition(String dbName, String 
tableName, List<String> parti
   public boolean getPartitionsByExpr(Table tbl, ExprNodeGenericFuncDesc expr, 
HiveConf conf,
       List<Partition> result) throws HiveException, TException {
     assert result != null;
+    boolean hasUnknownParts;
     byte[] exprBytes = SerializationUtilities.serializeExpressionToKryo(expr);
     String defaultPartitionName = HiveConf.getVar(conf, 
ConfVars.DEFAULTPARTITIONNAME);
-    List<org.apache.hadoop.hive.metastore.api.PartitionSpec> msParts =
-        new ArrayList<>();
-    boolean hasUnknownParts = 
getMSC().listPartitionsSpecByExpr(tbl.getDbName(),
-        tbl.getTableName(), exprBytes, defaultPartitionName, (short)-1, 
msParts);
+    List<org.apache.hadoop.hive.metastore.api.PartitionSpec> msParts = new 
ArrayList<>();
+
+    if (AcidUtils.isTransactionalTable(tbl)) {
+      PartitionsByExprRequest req = new PartitionsByExprRequest();
+      req.setDbName(tbl.getDbName());
+      req.setTblName((tbl.getTableName()));
+      req.setDefaultPartitionName(defaultPartitionName);
+      req.setMaxParts((short) -1);
+      req.setExpr(exprBytes);
+      ValidWriteIdList validWriteIdList = getValidWriteIdList(tbl.getDbName(), 
tbl.getTableName());
+      req.setValidWriteIdList(validWriteIdList != null ? 
validWriteIdList.toString() : null);
+      hasUnknownParts = getMSC().listPartitionsSpecByExpr(req, msParts);
+    } else {
+      hasUnknownParts = getMSC()
+          .listPartitionsSpecByExpr(tbl.getDbName(), tbl.getTableName(), 
exprBytes, defaultPartitionName, (short) -1,

Review comment:
       Makes sense, done. 




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to