You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pv...@apache.org on 2019/11/07 08:45:37 UTC

[hive] branch master updated: HIVE-22230: Add support for filtering partitions on temporary tables (Laszlo Pinter reviewed by Peter Vary)

This is an automated email from the ASF dual-hosted git repository.

pvary pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 6ab9316  HIVE-22230: Add support for filtering partitions on temporary tables (Laszlo Pinter reviewed by Peter Vary)
6ab9316 is described below

commit 6ab93165cfd40c2700541cd6ada56505c5b56dd7
Author: Laszlo Pinter <lp...@cloudera.com>
AuthorDate: Thu Nov 7 09:25:36 2019 +0100

    HIVE-22230: Add support for filtering partitions on temporary tables (Laszlo Pinter reviewed by Peter Vary)
---
 .../hadoop/hive/ql/metadata/PartitionTree.java     |  38 ++++
 .../ql/metadata/SessionHiveMetaStoreClient.java    | 252 +++++++++++++++------
 .../apache/hadoop/hive/ql/metadata/TempTable.java  |  16 +-
 .../hadoop/hive/metastore/TestMetastoreExpr.java   |   5 +-
 ...nHiveMetastoreClientGetPartitionsTempTable.java |   8 -
 ...HiveMetastoreClientListPartitionsTempTable.java | 157 +++++++++----
 .../hive/metastore/client/TestListPartitions.java  |  45 +---
 7 files changed, 352 insertions(+), 169 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java
index 00b4301..f518fc1 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java
@@ -22,7 +22,12 @@ import org.apache.hadoop.hive.metastore.api.InvalidOperationException;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
 import org.apache.hadoop.hive.metastore.api.Partition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -30,6 +35,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
+import static org.apache.hadoop.hive.metastore.Warehouse.LOG;
 import static org.apache.hadoop.hive.metastore.Warehouse.makePartName;
 import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.makePartNameMatcher;
 
@@ -38,6 +44,7 @@ import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.makePartName
  * via references.
  */
 final class PartitionTree {
+  private static final Logger LOG = LoggerFactory.getLogger(PartitionTree.class);
   private Map<String, org.apache.hadoop.hive.metastore.api.Partition> parts = new LinkedHashMap<>();
   private final org.apache.hadoop.hive.metastore.api.Table tTable;
 
@@ -233,4 +240,35 @@ final class PartitionTree {
       throws MetaException, InvalidOperationException, NoSuchObjectException {
     alterPartition(oldPartitionVals, newPart, true);
   }
+
+  /**
+   * Return a list of partitions matching the filter.
+   * @param filter filter string, must be not null.
+   * @return list of partitions, always not-null.
+   * @throws MetaException
+   */
+  List<Partition> getPartitionsByFilter(final String filter) throws MetaException {
+    if (filter == null || filter.isEmpty()) {
+      return new ArrayList<>(parts.values());
+    }
+    List<Partition> result = new ArrayList<>();
+    ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
+    if (se == null) {
+      LOG.error("JavaScript script engine is not found, therefore partition filtering "
+          + "for temporary tables is disabled.");
+      return result;
+    }
+    for (Map.Entry<String, Partition> entry : parts.entrySet()) {
+      se.put("partitionName", entry.getKey());
+      se.put("values", entry.getValue().getValues());
+      try {
+        if ((Boolean)se.eval(filter)) {
+          result.add(entry.getValue());
+        }
+      } catch (ScriptException e) {
+        throw new MetaException("Incorrect partition filter");
+      }
+    }
+    return result;
+  }
 }
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
index db3d9db..af77c4e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
@@ -32,7 +32,6 @@ import java.util.Set;
 import java.util.Map.Entry;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-
 import org.apache.commons.lang3.tuple.Pair;
 
 import org.apache.hadoop.conf.Configuration;
@@ -41,10 +40,12 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hive.common.FileUtils;
 import org.apache.hadoop.hive.common.StatsSetupConst;
+import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.io.HdfsUtils;
 import org.apache.hadoop.hive.metastore.HiveMetaHookLoader;
 import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
 import org.apache.hadoop.hive.metastore.IMetaStoreClient;
+import org.apache.hadoop.hive.metastore.PartFilterExprUtil;
 import org.apache.hadoop.hive.metastore.PartitionDropOptions;
 import org.apache.hadoop.hive.metastore.TableType;
 import org.apache.hadoop.hive.metastore.Warehouse;
@@ -64,12 +65,16 @@ import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
 import org.apache.hadoop.hive.metastore.api.Partition;
 import org.apache.hadoop.hive.metastore.api.PartitionListComposingSpec;
 import org.apache.hadoop.hive.metastore.api.PartitionSpec;
+import org.apache.hadoop.hive.metastore.api.PartitionValuesRequest;
+import org.apache.hadoop.hive.metastore.api.PartitionValuesResponse;
+import org.apache.hadoop.hive.metastore.api.PartitionValuesRow;
 import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
 import org.apache.hadoop.hive.metastore.api.SetPartitionsStatsRequest;
 import org.apache.hadoop.hive.metastore.api.TableMeta;
 import org.apache.hadoop.hive.metastore.api.UnknownDBException;
 import org.apache.hadoop.hive.metastore.api.UnknownTableException;
 import org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder;
+import org.apache.hadoop.hive.metastore.parser.ExpressionTree;
 import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy;
 import org.apache.hadoop.hive.ql.parse.SemanticAnalyzer;
 import org.apache.hadoop.hive.metastore.utils.SecurityUtils;
@@ -83,8 +88,9 @@ import org.slf4j.LoggerFactory;
 
 import static org.apache.hadoop.hive.metastore.Warehouse.getCatalogQualifiedTableName;
 import static org.apache.hadoop.hive.metastore.Warehouse.makePartName;
-import static org.apache.hadoop.hive.metastore.Warehouse.DEFAULT_CATALOG_NAME;
 import static org.apache.hadoop.hive.metastore.Warehouse.makeSpecFromName;
+import static org.apache.hadoop.hive.metastore.Warehouse.makeValsFromName;
+import static org.apache.hadoop.hive.metastore.Warehouse.DEFAULT_CATALOG_NAME;
 import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.compareFieldColumns;
 import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getColumnNamesForTable;
 import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getDefaultCatalog;
@@ -1065,27 +1071,18 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
    * @param maxParts maximum number of partitions to fetch, or -1 for all
    */
   @Override
-  public List<Partition> listPartitionsWithAuthInfo(String dbName,
-      String tableName, List<String> partialPvals, short maxParts, String userName,
+  public List<Partition> listPartitionsWithAuthInfo(String catName, String dbName,
+      String tableName, List<String> partialPvals, int maxParts, String userName,
       List<String> groupNames) throws TException {
     org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tableName);
     if (table == null) {
       //(assume) not a temp table - Try underlying client
-      return super.listPartitionsWithAuthInfo(dbName, tableName, partialPvals, maxParts, userName,
+      return super.listPartitionsWithAuthInfo(catName, dbName, tableName, partialPvals, maxParts, userName,
           groupNames);
     }
     TempTable tt = getPartitionedTempTable(table);
     List<Partition> parts = tt.listPartitionsByPartitionValsWithAuthInfo(partialPvals, userName, groupNames);
-    if (parts.isEmpty()) {
-      throw new NoSuchObjectException("Partition with partition values " +
-          (partialPvals != null ? Arrays.toString(partialPvals.toArray()) : "null") +
-          " for table " + tableName + " in database " + dbName + " is not found");
-    }
-    List<Partition> matchedParts = new ArrayList<>();
-    for(int i = 0; i < ((maxParts < 0 || maxParts > parts.size()) ? parts.size() : maxParts); i++) {
-      matchedParts.add(deepCopy(parts.get(i)));
-    }
-    return matchedParts;
+    return getPartitionsForMaxParts(tableName, parts, maxParts);
   }
 
   @Override
@@ -1098,17 +1095,7 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
     }
     TempTable tt = getPartitionedTempTable(table);
     List<Partition> partitions = tt.listPartitionsWithAuthInfo(userName, groupNames);
-    if (partitions.isEmpty()) {
-      throw new NoSuchObjectException(
-          "Partition for table " + tableName + " in database " + dbName + "and for user " +
-              userName + " and group names " + (groupNames != null ? Arrays.toString(groupNames.toArray()) : "null") +
-              " is not found.");
-    }
-    List<Partition> matchedParts = new ArrayList<>();
-    for(int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) {
-      matchedParts.add(deepCopy(partitions.get(i)));
-    }
-    return matchedParts;
+    return getPartitionsForMaxParts(tableName, partitions, maxParts);
   }
 
   @Override
@@ -1124,6 +1111,7 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
     for (int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) {
       result.add(makePartName(table.getPartitionKeys(), partitions.get(i).getValues()));
     }
+    Collections.sort(result);
     return result;
   }
 
@@ -1140,6 +1128,7 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
     for (int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) {
       result.add(makePartName(table.getPartitionKeys(), partitions.get(i).getValues()));
     }
+    Collections.sort(result);
     return result;
   }
 
@@ -1151,12 +1140,7 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
       return super.listPartitions(catName, dbName, tblName, maxParts);
     }
     TempTable tt = getPartitionedTempTable(table);
-    List<Partition> partitions = tt.listPartitions();
-    List<Partition> matchedParts = new ArrayList<>();
-    for(int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) {
-      matchedParts.add(deepCopy(partitions.get(i)));
-    }
-    return matchedParts;
+    return getPartitionsForMaxParts(tblName, tt.listPartitions(), maxParts);
   }
 
   @Override
@@ -1167,12 +1151,7 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
       return super.listPartitions(catName, dbName, tblName, partVals, maxParts);
     }
     TempTable tt = getPartitionedTempTable(table);
-    List<Partition> partitions = tt.getPartitionsByPartitionVals(partVals);
-    List<Partition> matchedParts = new ArrayList<>();
-    for(int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) {
-      matchedParts.add(deepCopy(partitions.get(i)));
-    }
-    return matchedParts;
+    return getPartitionsForMaxParts(tblName, tt.getPartitionsByPartitionVals(partVals), maxParts);
   }
 
   @Override
@@ -1183,25 +1162,20 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
       return super.listPartitionSpecs(catName, dbName, tableName, maxParts);
     }
     TempTable tt = getPartitionedTempTable(table);
-    List<Partition> partitions = tt.listPartitions();
-    if (partitions.isEmpty()) {
-      throw new NoSuchObjectException("Partition for table " + tableName + " in database " +
-          dbName + " is not found.");
-    }
-    List<PartitionSpec> partitionSpecs;
-    PartitionSpec partitionSpec = new PartitionSpec();
-    PartitionListComposingSpec partitionListComposingSpec = new PartitionListComposingSpec(new ArrayList<>());
-    for (int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) {
-      partitionListComposingSpec.addToPartitions(deepCopy(partitions.get(i)));
-    }
-    partitionSpec.setCatName(catName);
-    partitionSpec.setDbName(dbName);
-    partitionSpec.setTableName(tableName);
-    partitionSpec.setRootPath(table.getSd().getLocation());
-    partitionSpec.setPartitionList(partitionListComposingSpec);
-    partitionSpecs = Arrays.asList(partitionSpec);
+    return getPartitionSpecProxy(table, tt.listPartitions(), maxParts);
+  }
 
-    return PartitionSpecProxy.Factory.get(partitionSpecs);
+  @Override
+  public boolean listPartitionsByExpr(String catName, String dbName, String tblName, byte[] expr,
+      String defaultPartitionName, int maxParts, List<Partition> result) throws TException {
+    org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tblName);
+    if (table == null) {
+      return super.listPartitionsByExpr(catName, dbName, tblName, expr, defaultPartitionName, maxParts, result);
+    }
+    assert result != null;
+    result.addAll(getPartitionsForMaxParts(tblName, getPartitionedTempTable(table).listPartitionsByFilter(
+        generateJDOFilter(table, expr, defaultPartitionName)), maxParts));
+    return result.isEmpty();
   }
 
   @Override
@@ -1213,7 +1187,6 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
       return super.getPartitionsByNames(catName, dbName, tblName, partNames, getColStats, engine);
     }
     TempTable tt = getPartitionedTempTable(table);
-
     List<Partition> partitions = tt.getPartitionsByNames(partNames);
 
     return deepCopyPartitions(partitions);
@@ -1252,7 +1225,6 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
     if (table == null) {
       return super.dropPartition(catName, dbName, tblName, partVals, options);
     }
-    assertTempTablePartitioned(table);
     if (partVals == null || partVals.isEmpty() || partVals.contains(null)) {
       throw new MetaException("Partition values cannot be null, empty or contain null values");
     }
@@ -1262,13 +1234,8 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
     }
     Partition droppedPartition = tt.dropPartition(partVals);
     boolean result = droppedPartition != null ? true : false;
-    boolean purgeData = true;
-    boolean deleteData = true;
-    if (options != null) {
-      deleteData = options.deleteData;
-      purgeData = options.purgeData;
-    }
-
+    boolean purgeData = options != null ? options.purgeData : true;
+    boolean deleteData = options != null ? options.deleteData : true;
     if (deleteData && !tt.isExternal()) {
       result &= deletePartitionLocation(droppedPartition, purgeData);
     }
@@ -1284,9 +1251,6 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
       return super.dropPartition(catName, dbName, tableName, partitionName, deleteData);
     }
     TempTable tt = getPartitionedTempTable(table);
-    if (tt == null) {
-      throw new IllegalStateException("TempTable not found for " + getCatalogQualifiedTableName(table));
-    }
     Partition droppedPartition = tt.dropPartition(partitionName);
     boolean result = droppedPartition != null ? true : false;
     if (deleteData && !tt.isExternal()) {
@@ -1302,8 +1266,25 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
     if (table == null) {
       return super.dropPartitions(catName, dbName, tblName, partExprs, options);
     }
-    throw new UnsupportedOperationException("Dropping partitions for temporary tables, using an expression is not"
-        + "supported");
+    TempTable tt = getPartitionedTempTable(table);
+    List<Partition> result = new ArrayList<>();
+    for (Pair<Integer, byte[]> pair : partExprs) {
+      byte[] expr = pair.getRight();
+      String filter = generateJDOFilter(table, expr, conf.get(HiveConf.ConfVars.DEFAULTPARTITIONNAME.varname));
+      List<Partition> partitions = tt.listPartitionsByFilter(filter);
+      for (Partition p : partitions) {
+        Partition droppedPartition = tt.dropPartition(p.getValues());
+        if (droppedPartition != null) {
+          result.add(droppedPartition);
+          boolean purgeData = options != null ? options.purgeData : true;
+          boolean deleteData = options != null ? options.deleteData : true;
+          if (deleteData && !tt.isExternal()) {
+            deletePartitionLocation(droppedPartition, purgeData);
+          }
+        }
+      }
+    }
+    return result;
   }
 
   @Override
@@ -1430,6 +1411,134 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
     return appendPartitionToTempTable(table, partition);
   }
 
+  @Override
+  public List<Partition> listPartitionsByFilter(String catName, String dbName, String tableName,
+      String filter, int maxParts) throws TException {
+    org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tableName);
+    if (table == null) {
+      return super.listPartitionsByFilter(catName, dbName, tableName, filter, maxParts);
+    }
+    return getPartitionsForMaxParts(tableName, getPartitionedTempTable(table).listPartitionsByFilter(
+        generateJDOFilter(table, filter)), maxParts);
+  }
+
+  @Override
+  public int getNumPartitionsByFilter(String catName, String dbName, String tableName, String filter)
+      throws TException {
+    org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tableName);
+    if (table == null) {
+      return super.getNumPartitionsByFilter(catName, dbName, tableName, filter);
+    }
+    return getPartitionedTempTable(table).getNumPartitionsByFilter(generateJDOFilter(table, filter));
+  }
+
+  @Override
+  public PartitionSpecProxy listPartitionSpecsByFilter(String catName, String dbName, String tblName,
+      String filter, int maxParts) throws TException {
+    org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tblName);
+    if (table == null) {
+      return super.listPartitionSpecsByFilter(catName, dbName, tblName, filter, maxParts);
+    }
+    return getPartitionSpecProxy(table, getPartitionedTempTable(table).listPartitionsByFilter(generateJDOFilter(table,
+        filter)), maxParts);
+  }
+
+  @Override
+  public PartitionValuesResponse listPartitionValues(PartitionValuesRequest request) throws TException {
+    if (request == null || request.getPartitionKeys() == null || request.getPartitionKeys().isEmpty()) {
+      return super.listPartitionValues(request);
+    }
+    org.apache.hadoop.hive.metastore.api.Table table = getTempTable(request.getDbName(), request.getTblName());
+    if (table == null) {
+      return super.listPartitionValues(request);
+    }
+    TempTable tt = getPartitionedTempTable(table);
+    List<Partition> partitions = request.isSetFilter() ?
+        tt.listPartitionsByFilter(generateJDOFilter(table, request.getFilter())) :
+        tt.listPartitions();
+    List<String> partitionNames = new ArrayList<>();
+    for (Partition p : partitions) {
+      partitionNames.add(makePartName(table.getPartitionKeys(), p.getValues()));
+    }
+    if (partitionNames.isEmpty() && partitions.isEmpty()) {
+      throw new MetaException("Cannot obtain list of partition by filter:\"" + request.getFilter() +
+          "\" for " + getCatalogQualifiedTableName(table));
+    }
+    if (request.isSetAscending()) {
+      if (request.isAscending()) {
+        Collections.sort(partitionNames);
+      } else {
+        Collections.sort(partitionNames, Collections.reverseOrder());
+      }
+    }
+    PartitionValuesResponse response = new PartitionValuesResponse();
+    response.setPartitionValues(new ArrayList<>(partitionNames.size()));
+    for (String partName : partitionNames) {
+      ArrayList<String> vals = new ArrayList<>(Collections.nCopies(table.getPartitionKeysSize(), null));
+      PartitionValuesRow row = new PartitionValuesRow();
+      makeValsFromName(partName, vals);
+      vals.forEach(row::addToRow);
+      response.addToPartitionValues(row);
+    }
+    return response;
+  }
+
+  private PartitionSpecProxy getPartitionSpecProxy(org.apache.hadoop.hive.metastore.api.Table table,
+      List<Partition> partitions, int maxParts) throws MetaException {
+    List<PartitionSpec> partitionSpecs;
+    PartitionSpec partitionSpec = new PartitionSpec();
+    PartitionListComposingSpec partitionListComposingSpec = new PartitionListComposingSpec(new ArrayList<>());
+    for (int i = 0; i < ((maxParts < 0 || maxParts > partitions.size()) ? partitions.size() : maxParts); i++) {
+      partitionListComposingSpec.addToPartitions(deepCopy(partitions.get(i)));
+    }
+    partitionSpec.setCatName(table.getCatName());
+    partitionSpec.setDbName(table.getDbName());
+    partitionSpec.setTableName(table.getTableName());
+    partitionSpec.setRootPath(table.getSd().getLocation());
+    partitionSpec.setPartitionList(partitionListComposingSpec);
+    partitionSpecs = Arrays.asList(partitionSpec);
+
+    return PartitionSpecProxy.Factory.get(partitionSpecs);
+  }
+
+  private List<Partition> getPartitionsForMaxParts(String tableName, List<Partition> parts, int maxParts) {
+    List<Partition> matchedParts = new ArrayList<>();
+    for(int i = 0; i < ((maxParts < 0 || maxParts > parts.size()) ? parts.size() : maxParts); i++) {
+      matchedParts.add(deepCopy(parts.get(i)));
+    }
+    return matchedParts;
+  }
+
+  private String generateJDOFilter(org.apache.hadoop.hive.metastore.api.Table table, String filter)
+      throws MetaException {
+    ExpressionTree exprTree = org.apache.commons.lang.StringUtils.isNotEmpty(filter)
+        ? PartFilterExprUtil.getFilterParser(filter).tree : ExpressionTree.EMPTY_TREE;
+    return generateJDOFilter(table, exprTree);
+  }
+
+  private String generateJDOFilter(org.apache.hadoop.hive.metastore.api.Table table, byte[] expr,
+      String defaultPartitionName) throws MetaException {
+    ExpressionTree expressionTree = PartFilterExprUtil
+        .makeExpressionTree(PartFilterExprUtil.createExpressionProxy(conf), expr, defaultPartitionName);
+    return generateJDOFilter(table, expressionTree == null ? ExpressionTree.EMPTY_TREE : expressionTree);
+  }
+
+  private String generateJDOFilter(org.apache.hadoop.hive.metastore.api.Table table, ExpressionTree exprTree)
+      throws MetaException {
+
+    ExpressionTree.FilterBuilder filterBuilder = new ExpressionTree.FilterBuilder(true);
+    Map<String, Object> params = new HashMap<>();
+    exprTree.generateJDOFilterFragment(conf, table, params, filterBuilder);
+    StringBuilder stringBuilder = new StringBuilder(filterBuilder.getFilter());
+    // replace leading &&
+    stringBuilder.replace(0, 4, "");
+    params.entrySet().stream().forEach(e -> {
+      int index = stringBuilder.indexOf(e.getKey());
+      stringBuilder.replace(index, index + e.getKey().length(), "\"" + e.getValue().toString() + "\"");
+    });
+    return stringBuilder.toString();
+  }
+
   private Partition appendPartitionToTempTable(org.apache.hadoop.hive.metastore.api.Table table, Partition partition)
       throws MetaException, AlreadyExistsException {
     TempTable tt = getPartitionedTempTable(table);
@@ -1661,6 +1770,9 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
     }
     org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName, tableName);
     TempTable tt = getPartitionedTempTable(table);
+    if (tt == null) {
+      throw new IllegalStateException("TempTable not found for " + getCatalogQualifiedTableName(table));
+    }
     List<Partition> result = tt.addPartitions(deepCopyPartitions(partitions), ifNotExists);
     for (Partition p : result) {
       createAndSetLocationForAddedPartition(p, getPartitionLocation(table, p, false));
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/TempTable.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/TempTable.java
index e659b54..2c178ea 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/TempTable.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/TempTable.java
@@ -132,7 +132,10 @@ public final class TempTable {
   }
 
   private boolean checkPrivilegesForPartition(Partition partition, String userName, List<String> groupNames) {
-    if ((userName == null || userName.isEmpty()) && (groupNames == null || groupNames.isEmpty())) {
+    if (userName == null || userName.isEmpty()) {
+      return true;
+    }
+    if (groupNames == null || groupNames.isEmpty()) {
       return true;
     }
     PrincipalPrivilegeSet privileges = partition.getPrivileges();
@@ -145,9 +148,6 @@ public final class TempTable {
       }
     }
     if (privileges.isSetGroupPrivileges()) {
-      if (groupNames == null) {
-        return false;
-      }
       for (String group : groupNames) {
         if (!privileges.getGroupPrivileges().containsKey(group)) {
           return false;
@@ -192,4 +192,12 @@ public final class TempTable {
     pTree.renamePartition(partitionVals, newPart);
   }
 
+  int getNumPartitionsByFilter(String filter) throws MetaException {
+    return pTree.getPartitionsByFilter(filter).size();
+  }
+
+  List<Partition> listPartitionsByFilter(String filter) throws MetaException {
+    return pTree.getPartitionsByFilter(filter);
+  }
+
 }
diff --git a/ql/src/test/org/apache/hadoop/hive/metastore/TestMetastoreExpr.java b/ql/src/test/org/apache/hadoop/hive/metastore/TestMetastoreExpr.java
index c861107..6b10920 100644
--- a/ql/src/test/org/apache/hadoop/hive/metastore/TestMetastoreExpr.java
+++ b/ql/src/test/org/apache/hadoop/hive/metastore/TestMetastoreExpr.java
@@ -183,7 +183,10 @@ public class TestMetastoreExpr {
     assertEquals("Partition check failed: " + expr.getExprString(), numParts, parts.size());
   }
 
-  private static class ExprBuilder {
+  /**
+   * Helper class for building an expression.
+   */
+  public static class ExprBuilder {
     private final String tblName;
     private final Stack<ExprNodeDesc> stack = new Stack<ExprNodeDesc>();
 
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientGetPartitionsTempTable.java b/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientGetPartitionsTempTable.java
index d35621a..22b21b8 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientGetPartitionsTempTable.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientGetPartitionsTempTable.java
@@ -27,7 +27,6 @@ import org.apache.hadoop.hive.metastore.api.Table;
 import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
 import org.apache.hadoop.hive.metastore.api.PrivilegeGrantInfo;
 import org.apache.hadoop.hive.metastore.api.MetaException;
-import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
 import org.apache.hadoop.hive.metastore.client.CustomIgnoreRule;
 import org.apache.hadoop.hive.metastore.client.TestGetPartitions;
 import org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder;
@@ -171,13 +170,6 @@ public class TestSessionHiveMetastoreClientGetPartitionsTempTable extends TestGe
     super.testGetPartitionWithAuthInfoNullTblName();
   }
 
-  @Test(expected = NoSuchObjectException.class)
-  @Override
-  public void testGetPartitionWithAuthInfoNullGroups()
-      throws Exception {
-    super.testGetPartitionWithAuthInfoNullGroups();
-  }
-
   private void assertAuthInfoReturned(String userName, List<String> groups, Partition partition) {
     PrincipalPrivilegeSet privileges = partition.getPrivileges();
     assertNotNull(privileges);
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientListPartitionsTempTable.java b/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientListPartitionsTempTable.java
index a74b543..64f7a32 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientListPartitionsTempTable.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientListPartitionsTempTable.java
@@ -18,9 +18,9 @@
 
 package org.apache.hadoop.hive.ql.metadata;
 
-import com.google.common.collect.Lists;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.metastore.IMetaStoreClient;
+import org.apache.hadoop.hive.metastore.TestMetastoreExpr;
 import org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
@@ -33,7 +33,8 @@ import org.apache.hadoop.hive.metastore.client.TestListPartitions;
 import org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder;
 import org.apache.hadoop.hive.metastore.client.builder.TableBuilder;
 import org.apache.hadoop.hive.metastore.minihms.AbstractMetaStoreService;
-import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy;
+import org.apache.hadoop.hive.ql.exec.SerializationUtilities;
+import org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc;
 import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.thrift.TException;
 import org.junit.Before;
@@ -47,7 +48,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import static junit.framework.TestCase.assertFalse;
 import static junit.framework.TestCase.assertTrue;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -128,14 +128,6 @@ public class TestSessionHiveMetastoreClientListPartitionsTempTable
     assertTrue(privileges.getGroupPrivileges().containsKey(group));
   }
 
-  @Test
-  @Override
-  public void testListPartitionsAllHighMaxParts() throws Exception {
-    List<List<String>> testData = createTable4PartColsParts(getClient());
-    List<Partition> partitions = getClient().listPartitions(DB_NAME, TABLE_NAME, (short) 101);
-    assertFalse(partitions.isEmpty());
-    assertEquals(testData.size(), partitions.size());
-  }
 
   @Test(expected = MetaException.class)
   @Override
@@ -149,14 +141,6 @@ public class TestSessionHiveMetastoreClientListPartitionsTempTable
     super.testListPartitionsAllNullDbName();
   }
 
-  @Test
-  @Override
-  public void testListPartitionSpecsHighMaxParts() throws Exception {
-    List<List<String>> testValues = createTable4PartColsParts(getClient());
-    PartitionSpecProxy partitionSpecs = getClient().listPartitionSpecs(DB_NAME, TABLE_NAME, 101);
-    assertNotNull(partitionSpecs);
-    assertPartitionsSpecProxy(partitionSpecs, testValues);
-  }
 
   @Test(expected = MetaException.class)
   @Override
@@ -164,29 +148,6 @@ public class TestSessionHiveMetastoreClientListPartitionsTempTable
     super.testListPartitionSpecsNullTblName();
   }
 
-  @Test
-  @Override
-  public void testListPartitionsWithAuthHighMaxParts() throws Exception {
-    createTable4PartColsPartsAuthOn(getClient());
-    List<Partition> partitions =
-        getClient().listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short) 101, USER_NAME, Lists.newArrayList(GROUP));
-    partitions.forEach(p -> assertAuthInfoReturned(USER_NAME, GROUP, p));
-  }
-
-  @Test(expected = NoSuchObjectException.class)
-  @Override
-  public void testListPartitionsWithAuthNullGroup()
-      throws Exception {
-    super.testListPartitionsWithAuthNullGroup();
-  }
-
-  @Test(expected = NoSuchObjectException.class)
-  @Override
-  public void testListPartitionsWithAuthByValues()
-      throws Exception {
-    super.testListPartitionsWithAuthByValues();
-  }
-
   @Test(expected = MetaException.class)
   @Override
   public void testListPartitionsWithAuthByValuesNullDbName()
@@ -227,10 +188,116 @@ public class TestSessionHiveMetastoreClientListPartitionsTempTable
     super.testListPartitionNamesByValuesNullTblName();
   }
 
-  @Test
+  @Test(expected = MetaException.class)
+  @Override
+  public void testListPartitionsByFilterNullTblName() throws Exception {
+    super.testListPartitionsByFilterNullTblName();
+  }
+
+  @Test(expected = MetaException.class)
+  @Override
+  public void testListPartitionsByFilterNullDbName() throws Exception {
+    super.testListPartitionsByFilterNullDbName();
+  }
+
+  @Test(expected = MetaException.class)
   @Override
-  public void testListPartitionsWithAuthNoTable() throws Exception {
-    getClient().listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short)-1, "", Lists.newArrayList());
+  public void testListPartitionValuesNullDbName() throws Exception {
+    super.testListPartitionValuesNullDbName();
+  }
+
+  @Test(expected = MetaException.class)
+  @Override
+  public void testListPartitionValuesNullTblName() throws Exception {
+    super.testListPartitionValuesNullTblName();
+  }
+
+  @Test
+  public void testListPartitionsByExpr() throws Exception {
+    createTable4PartColsParts(getClient());
+    TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME);
+    checkExpr(2, e.strCol("yyyy").val("2017").pred("=", 2).build());
+    checkExpr(3, e.strCol("mm").val("11").pred(">", 2).build());
+    checkExpr(4, e.strCol("dd").val("29").pred(">=", 2).build());
+    checkExpr(2, e.strCol("yyyy").val("2017").pred("!=", 2).build());
+    checkExpr(1, e.strCol("yyyy").val("2017").pred("=", 2)
+        .strCol("mm").val("10").pred(">=", 2).pred("and", 2).build());
+    checkExpr(3, e.strCol("dd").val("10").pred("<", 2).strCol("yyyy")
+        .val("2009").pred("!=", 2).pred("or", 2).build());
+    checkExpr(0, e.strCol("yyyy").val("2019").pred("=", 2).build());
+  }
+
+  @Test(expected = AssertionError.class)
+  public void testListPartitionsByExprNullResult() throws Exception {
+    createTable4PartColsParts(getClient());
+    TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME);
+    getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, SerializationUtilities.serializeExpressionToKryo(
+        e.strCol("yyyy").val("2017").pred("=", 2).build()), null, (short)-1, null);
+  }
+
+  @Test
+  public void testListPartitionsByExprDefMaxParts() throws Exception {
+    createTable4PartColsParts(getClient());
+    TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME);
+    List<Partition> result = new ArrayList<>();
+    getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, SerializationUtilities.serializeExpressionToKryo(
+        e.strCol("yyyy").val("2017").pred(">=", 2).build()), null, (short)3, result);
+    assertEquals(3, result.size());
+  }
+
+  @Test
+  public void testListPartitionsByExprHighMaxParts() throws Exception {
+    createTable4PartColsParts(getClient());
+    TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME);
+    List<Partition> result = new ArrayList<>();
+    getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, SerializationUtilities.serializeExpressionToKryo(
+        e.strCol("yyyy").val("2017").pred(">=", 2).build()), null, (short)100, result);
+    assertEquals(4, result.size());
+  }
+
+  @Test(expected = NoSuchObjectException.class)
+  public void testListPartitionsByExprNoDb() throws Exception {
+    getClient().dropDatabase(DB_NAME);
+    getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, new byte[] {'f', 'o', 'o'},
+        null, (short)-1, new ArrayList<>());
+  }
+
+  @Test(expected = NoSuchObjectException.class)
+  public void testListPartitionsByExprNoTbl() throws Exception {
+    getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, new byte[] {'f', 'o', 'o'},
+        null, (short)-1, new ArrayList<>());
+  }
+
+  @Test(expected = NoSuchObjectException.class)
+  public void testListPartitionsByExprEmptyDbName() throws Exception {
+    getClient().listPartitionsByExpr("", TABLE_NAME, new byte[] {'f', 'o', 'o'},
+        null, (short)-1, new ArrayList<>());
+  }
+
+  @Test(expected = NoSuchObjectException.class)
+  public void testListPartitionsByExprEmptyTblName() throws Exception {
+    createTable3PartCols1Part(getClient());
+    getClient().listPartitionsByExpr(DB_NAME, "", new byte[] {'f', 'o', 'o'},
+        null, (short)-1, new ArrayList<>());
+  }
+
+  @Test(expected = MetaException.class)
+  public void testListPartitionsByExprNullDbName() throws Exception {
+    getClient().listPartitionsByExpr(null, TABLE_NAME, new byte[] {'f', 'o', 'o'},
+        null, (short)-1, new ArrayList<>());
+  }
+
+  @Test(expected = MetaException.class)
+  public void testListPartitionsByExprNullTblName() throws Exception {
+    getClient().listPartitionsByExpr(DB_NAME, null, new byte[] {'f', 'o', 'o' },
+        null, (short)-1, new ArrayList<>());
+  }
+
+  private void checkExpr(int numParts, ExprNodeGenericFuncDesc expr) throws Exception {
+    List<Partition> parts = new ArrayList<>();
+    getClient().listPartitionsByExpr(DB_NAME, TABLE_NAME, SerializationUtilities.serializeExpressionToKryo(expr),
+        null, (short) -1, parts);
+    assertEquals("Partition check failed: " + expr.getExprString(), numParts, parts.size());
   }
 
 }
diff --git a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java
index 94d37c2..8d0c095 100644
--- a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java
+++ b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java
@@ -282,6 +282,7 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = MetaException.class)
+  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsAllHighMaxParts() throws Exception {
     createTable3PartCols1Part(client);
     List<Partition> partitions = client.listPartitions(DB_NAME, TABLE_NAME, (short)101);
@@ -451,6 +452,7 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = MetaException.class)
+  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionSpecsHighMaxParts() throws Exception {
     createTable4PartColsParts(client);
     client.listPartitionSpecs(DB_NAME, TABLE_NAME, 101);
@@ -514,6 +516,7 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = MetaException.class)
+  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsWithAuthHighMaxParts() throws Exception {
     createTable4PartColsParts(client);
     client.listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short)101, "", Lists.newArrayList());
@@ -556,6 +559,7 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = NoSuchObjectException.class)
+  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsWithAuthNoTable() throws Exception {
     client.listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short)-1, "", Lists.newArrayList());
   }
@@ -757,7 +761,6 @@ public class TestListPartitions extends MetaStoreClientTest {
    */
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilter() throws Exception {
     List<List<String>> partValues = createTable4PartColsParts(client);
     List<Partition> partitions = client.listPartitionsByFilter(DB_NAME, TABLE_NAME,
@@ -780,7 +783,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterCaseInsensitive() throws Exception {
     String tableName = TABLE_NAME + "_caseinsensitive";
     Table t = createTestTable(client, DB_NAME, tableName,
@@ -823,7 +825,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterCaseSensitive() throws Exception {
     String tableName = TABLE_NAME + "_casesensitive";
     Table t = createTestTable(client, DB_NAME, tableName,
@@ -859,7 +860,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = MetaException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterInvalidFilter() throws Exception {
     createTable4PartColsParts(client);
     client.listPartitionsByFilter(DB_NAME, TABLE_NAME, "yyy=\"2017\"", (short)101);
@@ -873,34 +873,29 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterNoTblName() throws Exception {
     createTable4PartColsParts(client);
     client.listPartitionsByFilter(DB_NAME, "", "yyyy=\"2017\"", (short)-1);
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterNoDbName() throws Exception {
     createTable4PartColsParts(client);
     client.listPartitionsByFilter("", TABLE_NAME, "yyyy=\"2017\"", (short)-1);
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterNoTable() throws Exception {
     client.listPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"", (short)-1);
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterNoDb() throws Exception {
     client.dropDatabase(DB_NAME);
     client.listPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"", (short)-1);
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterNullTblName() throws Exception {
     try {
       createTable4PartColsParts(client);
@@ -912,7 +907,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterNullDbName() throws Exception {
     try {
       createTable4PartColsParts(client);
@@ -924,7 +918,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterNullFilter() throws Exception {
     createTable4PartColsParts(client);
     List<Partition> partitions = client.listPartitionsByFilter(DB_NAME, TABLE_NAME, null,
@@ -933,7 +926,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsByFilterEmptyFilter() throws Exception {
     createTable4PartColsParts(client);
     List<Partition> partitions = client.listPartitionsByFilter(DB_NAME, TABLE_NAME, "", (short)-1);
@@ -947,7 +939,6 @@ public class TestListPartitions extends MetaStoreClientTest {
    *         get_part_specs_by_filter(String,String,String,int).
    */
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionsSpecsByFilter() throws Exception {
     List<List<String>> testValues = createTable4PartColsParts(client);
     PartitionSpecProxy partSpecProxy = client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME,
@@ -980,7 +971,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = MetaException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionSpecsByFilterInvalidFilter() throws Exception {
     createTable4PartColsParts(client);
     client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, "yyy=\"2017\"", 101);
@@ -994,48 +984,41 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionSpecsByFilterNoTblName() throws Exception {
     createTable4PartColsParts(client);
     client.listPartitionSpecsByFilter(DB_NAME, "", "yyyy=\"2017\"", -1);
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionSpecsByFilterNoDbName() throws Exception {
     createTable4PartColsParts(client);
     client.listPartitionSpecsByFilter("", TABLE_NAME, "yyyy=\"2017\"", -1);
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionSpecsByFilterNoTable() throws Exception {
     client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"", -1);
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionSpecsByFilterNoDb() throws Exception {
     client.dropDatabase(DB_NAME);
     client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"", -1);
   }
 
   @Test(expected = MetaException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionSpecsByFilterNullTblName() throws Exception {
     createTable4PartColsParts(client);
     client.listPartitionSpecsByFilter(DB_NAME, null, "yyyy=\"2017\"", -1);
   }
 
   @Test(expected = MetaException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionSpecsByFilterNullDbName() throws Exception {
     createTable4PartColsParts(client);
     client.listPartitionSpecsByFilter(null, TABLE_NAME, "yyyy=\"2017\"", -1);
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionSpecsByFilterNullFilter() throws Exception {
     List<List<String>> values = createTable4PartColsParts(client);
     PartitionSpecProxy pproxy = client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, null, -1);
@@ -1043,7 +1026,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionSpecsByFilterEmptyFilter() throws Exception {
     List<List<String>> values = createTable4PartColsParts(client);
     PartitionSpecProxy pproxy = client.listPartitionSpecsByFilter(DB_NAME, TABLE_NAME, "", -1);
@@ -1057,7 +1039,6 @@ public class TestListPartitions extends MetaStoreClientTest {
    *         get_num_partitions_by_filter(String,String,String).
    */
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testGetNumPartitionsByFilter() throws Exception {
     createTable4PartColsParts(client);
     int n = client.getNumPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\" OR " +
@@ -1082,55 +1063,47 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = MetaException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testGetNumPartitionsByFilterInvalidFilter() throws Exception {
     createTable4PartColsParts(client);
     client.getNumPartitionsByFilter(DB_NAME, TABLE_NAME, "yyy=\"2017\"");
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testGetNumPartitionsByFilterNoTblName() throws Exception {
     createTable4PartColsParts(client);
     client.getNumPartitionsByFilter(DB_NAME, "", "yyyy=\"2017\"");
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testGetNumPartitionsByFilterNoDbName() throws Exception {
     createTable4PartColsParts(client);
     client.getNumPartitionsByFilter("", TABLE_NAME, "yyyy=\"2017\"");
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testGetNumPartitionsByFilterNoTable() throws Exception {
     client.getNumPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"");
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testGetNumPartitionsByFilterNoDb() throws Exception {
     client.dropDatabase(DB_NAME);
     client.getNumPartitionsByFilter(DB_NAME, TABLE_NAME, "yyyy=\"2017\"");
   }
 
   @Test(expected = MetaException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testGetNumPartitionsByFilterNullTblName() throws Exception {
     createTable4PartColsParts(client);
     client.getNumPartitionsByFilter(DB_NAME, null, "yyyy=\"2017\"");
   }
 
   @Test(expected = MetaException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testGetNumPartitionsByFilterNullDbName() throws Exception {
     createTable4PartColsParts(client);
     client.getNumPartitionsByFilter(null, TABLE_NAME, "yyyy=\"2017\"");
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testGetNumPartitionsByFilterNullFilter() throws Exception {
     createTable4PartColsParts(client);
     int n = client.getNumPartitionsByFilter(DB_NAME, TABLE_NAME, null);
@@ -1340,7 +1313,6 @@ public class TestListPartitions extends MetaStoreClientTest {
    *         get_partition_values(PartitionValuesRequest).
    */
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionValues() throws Exception {
     List<List<String>> testValues = createTable4PartColsParts(client);
     List<FieldSchema> partitionSchema = Lists.newArrayList(
@@ -1355,7 +1327,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionValuesEmptySchema() throws Exception {
     try {
       List<List<String>> testValues = createTable4PartColsParts(client);
@@ -1371,7 +1342,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionValuesNoDbName() throws Exception {
     createTable4PartColsParts(client);
     List<FieldSchema> partitionSchema = Lists.newArrayList(
@@ -1384,7 +1354,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = NoSuchObjectException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionValuesNoTblName() throws Exception {
     createTable4PartColsParts(client);
     List<FieldSchema> partitionSchema = Lists.newArrayList(
@@ -1397,7 +1366,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = MetaException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionValuesNoTable() throws Exception {
     List<FieldSchema> partitionSchema = Lists.newArrayList(
             new FieldSchema("yyyy", "string", ""),
@@ -1409,9 +1377,7 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test(expected = MetaException.class)
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionValuesNoDb() throws Exception {
-    client.dropDatabase(DB_NAME);
     List<FieldSchema> partitionSchema = Lists.newArrayList(
             new FieldSchema("yyyy", "string", ""),
             new FieldSchema("mm", "string", ""));
@@ -1422,7 +1388,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionValuesNullDbName() throws Exception {
     try {
       createTable4PartColsParts(client);
@@ -1458,7 +1423,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionValuesNullSchema() throws Exception {
     try {
       createTable4PartColsParts(client);
@@ -1472,7 +1436,6 @@ public class TestListPartitions extends MetaStoreClientTest {
   }
 
   @Test
-  @ConditionalIgnoreOnSessionHiveMetastoreClient
   public void testListPartitionValuesNullRequest() throws Exception {
     try {
       createTable4PartColsParts(client);