private void buildString(boolean useLeafIds, StringBuilder output) {
    switch (operator) {
      case OR:
        output.append("(or");
        for(ExpressionTree child: children) {
          output.append(' ');
          child.buildString(useLeafIds, output);
        }
        output.append(')');
        break;
      case AND:
        output.append("(and");
        for(ExpressionTree child: children) {
          output.append(' ');
          child.buildString(useLeafIds, output);
        }
        output.append(')');
        break;
      case NOT:
        output.append("(not ");
        children.get(0).buildString(useLeafIds, output);
        output.append(')');
        break;
      case LEAF:
        output.append("leaf-");
        if (useLeafIds) {
          output.append(leaf.getId());
        } else {
          output.append(leaf);
        }
        break;
      case CONSTANT:
        output.append(constant);
        break;
    }
  }
The inner representation of the SearchArgument. Most users should not
need this interface, it is only for file formats that need to translate
the SearchArgument into an internal form.
storage-api/src/java/org/apache/hadoop/hive/ql/io/sarg/ExpressionTree.java