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



##########
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:
       Maybe use the same listPartitionsSpecByExpr for both cases?




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