private Integer getNumPartitionsViaOrmFilter(String catName, String dbName, String tblName, ExpressionTree tree, boolean isValidatedFilter, List<FieldSchema> partitionKeys)
          throws MetaException {
    Map<String, Object> params = new HashMap<>();
    String jdoFilter = makeQueryFilterString(catName, dbName, tblName, tree,
            params, isValidatedFilter, partitionKeys);
    if (jdoFilter == null) {
      assert !isValidatedFilter;
      return null;
    }

    try (QueryWrapper query = new QueryWrapper(pm.newQuery(
        "select count(partitionName) from org.apache.hadoop.hive.metastore.model.MPartition"))) {
      query.setFilter(jdoFilter);
      String parameterDeclaration = makeParameterDeclarationStringObj(params);
      query.declareParameters(parameterDeclaration);
      Long result = (Long) query.executeWithMap(params);

      return result.intValue();
    }
  }
Gets partition names from the table via ORM (JDOQL) filter pushdown.
@param tblName The table.
@param tree The expression tree from which JDOQL filter will be made.
@param isValidatedFilter Whether the filter was pre-validated for JDOQL pushdown by a client
  (old hive client or non-hive one); if it was and we fail to create a filter, we will throw.
@param args additional arguments for getting partitions
@return Resulting partitions. Can be null if isValidatedFilter is false, and
        there was error deriving the JDO filter.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java