static void compactLeaves(ExpressionTree tree,
                              List<PredicateLeaf> leaves) {
      if (tree.getOperator() == ExpressionTree.Operator.LEAF) {
        PredicateLeafImpl newLeaf = (PredicateLeafImpl) tree.getPredicateLeaf();
        if (newLeaf.getId() == -1) {
          newLeaf.setId(leaves.size());
          leaves.add(newLeaf);
        }
      } else if (tree.getChildren() != null){
        for(ExpressionTree child: tree.getChildren()) {
          compactLeaves(child, leaves);
        }
      }
    }
Recursively explore the tree to find the leaves that are still reachable
after optimizations.
@param tree the node to check next
@param leaves the list of leaves that were found
storage-api/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java