public static String toJsonString(final RelNode rel) {
    if (rel == null) {
      return null;
    }

    final HiveRelJsonImpl planWriter = new HiveRelJsonImpl();
    rel.explain(planWriter);
    return planWriter.asString();
  }
Converts a relational expression to a string, showing information that will aid
to parse the string back.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelOptUtil.java