private String makeQueryFilterString(String catName, String dbName, Table table,
                                       ExpressionTree tree, Map<String, Object> params,
                                       boolean isValidatedFilter) throws MetaException {
    assert tree != null;
    FilterBuilder queryBuilder = new FilterBuilder(isValidatedFilter);
    if (table != null) {
      queryBuilder.append("table.tableName == t1 && table.database.name == t2 && table.database.catalogName == t3");
      params.put("t1", table.getTableName());
      params.put("t2", table.getDbName());
      params.put("t3", table.getCatName());
    } else {
      queryBuilder.append("database.name == dbName && database.catalogName == catName");
      params.put("dbName", dbName);
      params.put("catName", catName);
    }

    tree.accept(new ExpressionTree.JDOFilterGenerator(getConf(),
        table != null ? table.getPartitionKeys() : null, queryBuilder, params));
    if (queryBuilder.hasError()) {
      assert !isValidatedFilter;
      LOG.debug("JDO filter pushdown cannot be used: {}", queryBuilder.getErrorMessage());
      return null;
    }
    String jdoFilter = queryBuilder.getFilter();
    LOG.debug("jdoFilter = {}", jdoFilter);
    return jdoFilter;
  }
Makes a JDO query filter string for tables or partitions.
@param dbName Database name.
@param table Table. If null, the query returned is over tables in a database.
  If not null, the query returned is over partitions in a table.
@param tree The expression tree from which JDOQL filter will be made.
@param params Parameters for the filter. Some parameters may be added here.
@param isValidatedFilter Whether the filter was pre-validated for JDOQL pushdown
  by the client; if it was and we fail to create a filter, we will throw.
@return Resulting filter. Can be null if isValidatedFilter is false, and there was error.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java