RelOptUtil { public static String dumpType(RelDataType type) { final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); final TypeDumper typeDumper = new TypeDumper(pw); if (type.isStruct()) { typeDumper.acceptFields(type.getFieldList()); } else { typeDumper.accept(type); } pw.flush(); return sw.toString(); }  static Set<String> getVariablesSet(RelNode rel); static List<String> getVariablesSetAndUsed(
      RelNode rel0,
      RelNode rel1); static Set<String> getVariablesUsed(RelNode rel); static void go(
      RelVisitor visitor,
      RelNode p); static List<RelDataType> getFieldTypeList(final RelDataType type); static boolean areRowTypesEqual(
      RelDataType rowType1,
      RelDataType rowType2,
      boolean compareNames); static void verifyTypeEquivalence(
      RelNode originalRel,
      RelNode newRel,
      Object equivalenceClass); static Mappings.TargetMapping permutation(
      List<RexNode> nodes,
      RelDataType inputRowType); static RelNode createExistsPlan(
      RelOptCluster cluster,
      RelNode seekRel,
      List<RexNode> conditions,
      RexLiteral extraExpr,
      String extraName); static RelNode createExistsPlan(
      RelOptCluster cluster,
      RelNode seekRel,
      boolean isIn,
      boolean isExists,
      boolean needsOuterJoin); static RelNode createRenameRel(
      RelDataType outputType,
      RelNode rel); static RelNode createNullFilter(
      RelNode rel,
      Integer[] fieldOrdinals); static RelNode createCastRel(
      final RelNode rel,
      RelDataType castRowType,
      boolean rename); static RelNode createSingleValueAggRel(
      RelOptCluster cluster,
      RelNode rel); static RelNode createDistinctRel(
      RelNode rel); static boolean analyzeSimpleEquiJoin(
      JoinRel joinRel,
      int[] joinFieldOrdinals); static RexNode splitJoinCondition(
      RelNode left,
      RelNode right,
      RexNode condition,
      List<Integer> leftKeys,
      List<Integer> rightKeys); static boolean isEqui(
      RelNode left,
      RelNode right,
      RexNode condition); static RexNode splitJoinCondition(
      List<RelDataTypeField> sysFieldList,
      RelNode leftRel,
      RelNode rightRel,
      RexNode condition,
      List<RexNode> leftJoinKeys,
      List<RexNode> rightJoinKeys,
      List<Integer> filterNulls,
      List<SqlOperator> rangeOp); static RexNode splitCorrelatedFilterCondition(
      FilterRel filterRel,
      List<RexInputRef> joinKeys,
      List<RexNode> correlatedJoinKeys); static RexNode splitCorrelatedFilterCondition(
      FilterRel filterRel,
      List<RexNode> joinKeys,
      List<RexNode> correlatedJoinKeys,
      boolean extractCorrelatedFieldAccess); static void projectJoinInputs(
      RelNode[] inputRels,
      List<RexNode> leftJoinKeys,
      List<RexNode> rightJoinKeys,
      int systemColCount,
      List<Integer> leftKeys,
      List<Integer> rightKeys,
      List<Integer> outputProj); static RelNode createProjectJoinRel(
      List<Integer> outputProj,
      RelNode joinRel); static void registerAbstractRels(RelOptPlanner planner); static String dumpPlan(
      String header,
      RelNode rel,
      boolean asXml,
      SqlExplainLevel detailLevel); static RelDataType createDmlRowType(
      SqlKind kind,
      RelDataTypeFactory typeFactory); static boolean eq(
      final String desc1,
      RelDataType type1,
      final String desc2,
      RelDataType type2,
      boolean fail); static boolean equal(
      final String desc1,
      RelDataType type1,
      final String desc2,
      RelDataType type2,
      boolean fail); static boolean equalType(String desc0, RelNode rel0, String desc1,
      RelNode rel1, boolean fail); static RexNode isDistinctFrom(
      RexBuilder rexBuilder,
      RexNode x,
      RexNode y,
      boolean neg); static String toString(final RelNode rel); static String toString(
      final RelNode rel,
      SqlExplainLevel detailLevel); static RelNode renameIfNecessary(
      RelNode rel,
      RelDataType desiredRowType); static String dumpType(RelDataType type); static void decomposeConjunction(
      RexNode rexPredicate,
      List<RexNode> rexList); static void decomposeConjunction(
      RexNode rexPredicate,
      List<RexNode> rexList,
      List<RexNode> notList); static void decomposeDisjunction(
      RexNode rexPredicate,
      List<RexNode> rexList); static List<RexNode> conjunctions(RexNode rexPredicate); static List<RexNode> disjunctions(RexNode rexPredicate); static RexNode andJoinFilters(
      RexBuilder rexBuilder,
      RexNode left,
      RexNode right); static List<Integer> adjustKeys(List<Integer> keys, int adjustment); static boolean classifyFilters(
      RelNode joinRel,
      List<RexNode> filters,
      boolean pushJoin,
      boolean pushLeft,
      boolean pushRight,
      List<RexNode> joinFilters,
      List<RexNode> leftFilters,
      List<RexNode> rightFilters); static void splitFilters(
      BitSet childBitmap,
      RexNode predicate,
      List<RexNode> pushable,
      List<RexNode> notPushable); static RexNode[] splitJoinCondition(
      RelNode left,
      RelNode right,
      RexNode condition); static boolean checkProjAndChildInputs(
      ProjectRelBase project,
      boolean checkNames); static List<RexNode> createSwappedJoinExprs(
      RelNode newJoin,
      JoinRelBase origJoin,
      boolean origOrder); static RexNode pushFilterPastProject(
      RexNode filter,
      ProjectRelBase projRel); static MultiJoinRel projectMultiJoin(
      MultiJoinRel multiJoin,
      ProjectRel project); static T addTrait(
      T rel, RelTrait trait); static RelNode replaceInput(
      RelNode parent, int ordinal, RelNode newInput); static ProjectRel project(
      RelNode child,
      Mappings.TargetMapping mapping); static boolean contains(RelNode ancestor, final RelNode target); static RelNode replace(RelNode query, RelNode find, RelNode replace); static RelOptTable.ToRelContext getContext(
      final RelOptCluster cluster); static int countJoins(RelNode rootRel); static final double EPSILON; }
@Test public void testTypeDump() { RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); RelDataType t1 = typeFactory.builder() .add("f0", SqlTypeName.DECIMAL, 5, 2) .add("f1", SqlTypeName.VARCHAR, 10) .build(); TestUtil.assertEqualsVerbose( TestUtil.fold( "f0 DECIMAL(5, 2) NOT NULL,", "f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL"), Util.toLinux(RelOptUtil.dumpType(t1) + "\n")); RelDataType t2 = typeFactory.builder() .add("f0", t1) .add("f1", typeFactory.createMultisetType(t1, -1)) .build(); TestUtil.assertEqualsVerbose( TestUtil.fold( "f0 RECORD (", " f0 DECIMAL(5, 2) NOT NULL,", " f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL) NOT NULL,", "f1 RECORD (", " f0 DECIMAL(5, 2) NOT NULL,", " f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL) NOT NULL MULTISET NOT NULL"), Util.toLinux(RelOptUtil.dumpType(t2) + "\n")); }