Java Code Examples for org.apache.calcite.sql.SqlExplainLevel#EXPPLAN_ATTRIBUTES

The following examples show how to use org.apache.calcite.sql.SqlExplainLevel#EXPPLAN_ATTRIBUTES . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SqlToOperationConverter.java    From flink with Apache License 2.0 5 votes vote down vote up
/** Convert EXPLAIN statement. */
private Operation convertExplain(SqlExplain sqlExplain) {
	Operation operation = convertSqlQuery(sqlExplain.getExplicandum());

	if (sqlExplain.getDetailLevel() != SqlExplainLevel.EXPPLAN_ATTRIBUTES ||
			sqlExplain.getDepth() != SqlExplain.Depth.PHYSICAL ||
			sqlExplain.getFormat() != SqlExplainFormat.TEXT) {
		throw new TableException("Only default behavior is supported now, EXPLAIN PLAN FOR xx");
	}

	return new ExplainOperation(operation);
}
 
Example 2
Source File: SqlToOperationConverter.java    From flink with Apache License 2.0 5 votes vote down vote up
/** Convert EXPLAIN statement. */
private Operation convertExplain(SqlExplain sqlExplain) {
	Operation operation = convertSqlQuery(sqlExplain.getExplicandum());

	if (sqlExplain.getDetailLevel() != SqlExplainLevel.EXPPLAN_ATTRIBUTES ||
			sqlExplain.getDepth() != SqlExplain.Depth.PHYSICAL ||
			sqlExplain.getFormat() != SqlExplainFormat.TEXT) {
		throw new TableException("Only default behavior is supported now, EXPLAIN PLAN FOR xx");
	}

	return new ExplainOperation(operation);
}
 
Example 3
Source File: SqlToRelConverterTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testExplainAsXml() {
  String sql = "select 1 + 2, 3 from (values (true))";
  final RelNode rel = tester.convertSqlToRel(sql).rel;
  StringWriter sw = new StringWriter();
  PrintWriter pw = new PrintWriter(sw);
  RelXmlWriter planWriter =
      new RelXmlWriter(pw, SqlExplainLevel.EXPPLAN_ATTRIBUTES);
  rel.explain(planWriter);
  pw.flush();
  TestUtil.assertEqualsVerbose(
      "<RelNode type=\"LogicalProject\">\n"
          + "\t<Property name=\"EXPR$0\">\n"
          + "\t\t+(1, 2)\n"
          + "\t</Property>\n"
          + "\t<Property name=\"EXPR$1\">\n"
          + "\t\t3\n"
          + "\t</Property>\n"
          + "\t<Inputs>\n"
          + "\t\t<RelNode type=\"LogicalValues\">\n"
          + "\t\t\t<Property name=\"tuples\">\n"
          + "\t\t\t\t[{ true }]\n"
          + "\t\t\t</Property>\n"
          + "\t\t\t<Inputs/>\n"
          + "\t\t</RelNode>\n"
          + "\t</Inputs>\n"
          + "</RelNode>\n",
      Util.toLinux(sw.toString()));
}
 
Example 4
Source File: RelWriterImpl.java    From Bats with Apache License 2.0 4 votes vote down vote up
public RelWriterImpl(PrintWriter pw) {
  this(pw, SqlExplainLevel.EXPPLAN_ATTRIBUTES, true);
}
 
Example 5
Source File: RelDescriptionWriterImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public SqlExplainLevel getDetailLevel() {
	return SqlExplainLevel.EXPPLAN_ATTRIBUTES;
}
 
Example 6
Source File: RelDescriptionWriterImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public SqlExplainLevel getDetailLevel() {
	return SqlExplainLevel.EXPPLAN_ATTRIBUTES;
}
 
Example 7
Source File: RelWriterImpl.java    From calcite with Apache License 2.0 4 votes vote down vote up
public RelWriterImpl(PrintWriter pw) {
  this(pw, SqlExplainLevel.EXPPLAN_ATTRIBUTES, true);
}