public static ExpressionTree makeExpressionTree(PartitionExpressionProxy expressionProxy,
      byte[] expr, String defaultPartitionName, Configuration conf) throws MetaException {
    // We will try pushdown first, so make the filter. This will also validate the expression,
    // if serialization fails we will throw incompatible metastore error to the client.
    String filter = null;
    try {
      filter = expressionProxy.convertExprToFilter(expr, defaultPartitionName,
          conf.getBoolean(MetastoreConf.ConfVars.DECODE_FILTER_EXPRESSION_TO_STRING.getVarname(), false));
    } catch (MetaException ex) {
      // TODO MS-SPLIT - for now we have construct this by reflection because IMetaStoreClient
      // can't be
      // moved until after HiveMetaStore is moved, which can't be moved until this is moved.
      Class<? extends MetaException> exClass = JavaUtils.getClass(
          "org.apache.hadoop.hive.metastore.IMetaStoreClient$IncompatibleMetastoreException",
          MetaException.class);
      throw JavaUtils.newInstance(exClass, new Class<?>[]{String.class}, new Object[]{ex.getMessage()});
    }

    // Make a tree out of the filter.
    // TODO: this is all pretty ugly. The only reason we need all these transformations
    //       is to maintain support for simple filters for HCat users that query metastore.
    //       If forcing everyone to use thick client is out of the question, maybe we could
    //       parse the filter into standard hive expressions and not all this separate tree
    //       Filter.g stuff. That way this method and ...ByFilter would just be merged.
    return PartFilterExprUtil.makeExpressionTree(filter);
  }
Utility functions for working with partition filter expressions
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartFilterExprUtil.java