private static FilterPredicate translate(ExpressionTree root,
                                           List<PredicateLeaf> leaves,
                                           Map<String, TypeInfo> columns,
                                           MessageType schema) throws Exception {
    FilterPredicate p = null;
    switch (root.getOperator()) {
      case OR:
        for(ExpressionTree child: root.getChildren()) {
          FilterPredicate childPredicate = translate(child, leaves, columns, schema);
          if (childPredicate == null) {
            return null;
          }

          if (p == null) {
            p = childPredicate;
          } else {
            p = FilterApi.or(p, childPredicate);
          }
        }
        return p;
      case AND:
        for(ExpressionTree child: root.getChildren()) {
          if (p == null) {
            p = translate(child, leaves, columns, schema);
          } else {
            FilterPredicate right = translate(child, leaves, columns, schema);
            // constant means no filter, ignore it when it is null
            if(right != null){
              p = FilterApi.and(p, right);
            }
          }
        }
        return p;
      case NOT:
        FilterPredicate op = translate(root.getChildren().get(0), leaves,
            columns, schema);
        if (op != null) {
          return FilterApi.not(op);
        } else {
          return null;
        }
      case LEAF:
        PredicateLeaf leaf = leaves.get(root.getLeaf());

        // If columns is null, then we need to create the leaf
        if (columns.containsKey(leaf.getColumnName())) {
          Type parquetType = schema.getType(leaf.getColumnName());
          TypeInfo hiveType = columns.get(leaf.getColumnName());
          return buildFilterPredicateFromPredicateLeaf(leaf, parquetType, hiveType);
        } else {
          // Do not create predicate if the leaf is not on the passed schema.
          return null;
        }
      case CONSTANT:
        return null;// no filter will be executed for constant
      default:
        throw new IllegalStateException("Unknown operator: " +
            root.getOperator());
    }
  }
Translate the search argument to the filter predicate parquet uses. It includes
only the columns from the passed schema.
@return  a filter predicate translated from search argument. null is returned
         if failed to convert.
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/read/ParquetFilterPredicateConverter.java