use of org.apache.calcite.rel.RelWriter in project calcite by apache.
the class RelOptUtil method toString.
/**
* Converts a relational expression to a string.
*/
public static String toString(final RelNode rel, SqlExplainLevel detailLevel) {
if (rel == null) {
return null;
}
final StringWriter sw = new StringWriter();
final RelWriter planWriter = new RelWriterImpl(new PrintWriter(sw), detailLevel, false);
rel.explain(planWriter);
return sw.toString();
}
use of org.apache.calcite.rel.RelWriter in project hive by apache.
the class RelTreeSignature method relSignature.
private String relSignature(RelNode rel) {
if (rel == null) {
return null;
}
final StringWriter sw = new StringWriter();
final RelWriter planWriter = new NonRecursiveRelWriterImpl(new PrintWriter(sw), SqlExplainLevel.EXPPLAN_ATTRIBUTES, false);
rel.explain(planWriter);
return sw.toString();
}
use of org.apache.calcite.rel.RelWriter in project drill by axbaretto.
the class PrelSequencer method printWithIds.
public static String printWithIds(final Prel rel, SqlExplainLevel explainlevel) {
if (rel == null) {
return null;
}
final StringWriter sw = new StringWriter();
final RelWriter planWriter = new NumberingRelWriter(getIdMap(rel), new PrintWriter(sw), explainlevel);
rel.explain(planWriter);
return sw.toString();
}
use of org.apache.calcite.rel.RelWriter in project calcite by apache.
the class RelOptUtil method dumpPlan.
/**
* Dumps a plan as a string.
*
* @param header Header to print before the plan. Ignored if the format
* is XML
* @param rel Relational expression to explain
* @param format Output format
* @param detailLevel Detail level
* @return Plan
*/
public static String dumpPlan(String header, RelNode rel, SqlExplainFormat format, SqlExplainLevel detailLevel) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
if (!header.equals("")) {
pw.println(header);
}
RelWriter planWriter;
switch(format) {
case XML:
planWriter = new RelXmlWriter(pw, detailLevel);
break;
case JSON:
planWriter = new RelJsonWriter();
rel.explain(planWriter);
return ((RelJsonWriter) planWriter).asString();
default:
planWriter = new RelWriterImpl(pw, detailLevel, false);
}
rel.explain(planWriter);
pw.flush();
return sw.toString();
}
use of org.apache.calcite.rel.RelWriter in project drill by apache.
the class PrelSequencer method printWithIds.
public static String printWithIds(final Prel rel, SqlExplainLevel explainlevel) {
if (rel == null) {
return null;
}
final StringWriter sw = new StringWriter();
final RelWriter planWriter = new NumberingRelWriter(getIdMap(rel), new PrintWriter(sw), explainlevel);
rel.explain(planWriter);
return sw.toString();
}
Aggregations