예제 #1
0
파일: SortRel.java 프로젝트: baeeq/optiq
 public RelOptPlanWriter explainTerms(RelOptPlanWriter pw) {
   super.explainTerms(pw);
   assert fieldExps.length == collations.size();
   for (Ord<RexNode> ord : Ord.zip(fieldExps)) {
     pw.item("sort" + ord.i, ord.e);
   }
   for (Ord<RelFieldCollation> ord : Ord.zip(collations)) {
     pw.item("dir" + ord.i, ord.e.shortString());
   }
   return pw;
 }
예제 #2
0
 // implement RelNode
 public void explain(RelOptPlanWriter pw) {
   // A little adapter just to get the tuples to come out
   // with curly brackets instead of square brackets.  Plus
   // more whitespace for readability.
   List<String> renderList = new ArrayList<String>();
   for (List<RexLiteral> tuple : tuples) {
     String s = tuple.toString();
     assert (s.startsWith("["));
     assert (s.endsWith("]"));
     renderList.add("{ " + s.substring(1, s.length() - 1) + " }");
   }
   if (pw.getDetailLevel() == SqlExplainLevel.DIGEST_ATTRIBUTES) {
     // For rel digest, include the row type since a rendered
     // literal may leave the type ambiguous (e.g. "null").
     pw.explain(this, new String[] {"type", "tuples"}, new Object[] {rowType, renderList});
   } else {
     // For normal EXPLAIN PLAN, omit the type.
     pw.explain(this, new String[] {"tuples"}, new Object[] {renderList});
   }
 }