use of org.apache.calcite.sql.SqlWriter in project flink by apache.
the class SqlAlterViewProperties method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
super.unparse(writer, leftPrec, rightPrec);
writer.keyword("SET");
SqlWriter.Frame withFrame = writer.startList("(", ")");
for (SqlNode property : propertyList) {
printIndent(writer);
property.unparse(writer, leftPrec, rightPrec);
}
writer.newlineAndIndent();
writer.endList(withFrame);
}
use of org.apache.calcite.sql.SqlWriter in project flink by apache.
the class SqlAlterTableOptions method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
super.unparse(writer, leftPrec, rightPrec);
writer.keyword("SET");
SqlWriter.Frame withFrame = writer.startList("(", ")");
for (SqlNode property : propertyList) {
printIndent(writer);
property.unparse(writer, leftPrec, rightPrec);
}
writer.newlineAndIndent();
writer.endList(withFrame);
}
use of org.apache.calcite.sql.SqlWriter in project flink by apache.
the class SqlAlterTableReset method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
super.unparse(writer, leftPrec, rightPrec);
writer.keyword("RESET");
SqlWriter.Frame withFrame = writer.startList("(", ")");
for (SqlNode property : propertyKeyList) {
printIndent(writer);
property.unparse(writer, leftPrec, rightPrec);
}
writer.newlineAndIndent();
writer.endList(withFrame);
}
use of org.apache.calcite.sql.SqlWriter in project flink by apache.
the class SqlLoadModule method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
writer.keyword("LOAD MODULE");
moduleName.unparse(writer, leftPrec, rightPrec);
if (this.propertyList.size() > 0) {
writer.keyword("WITH");
SqlWriter.Frame withFrame = writer.startList("(", ")");
for (SqlNode property : propertyList) {
printIndent(writer);
property.unparse(writer, leftPrec, rightPrec);
}
writer.newlineAndIndent();
writer.endList(withFrame);
}
}
use of org.apache.calcite.sql.SqlWriter in project calcite by apache.
the class SqlBetweenOperator method unparse.
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
final SqlWriter.Frame frame = writer.startList(FRAME_TYPE, "", "");
call.operand(VALUE_OPERAND).unparse(writer, getLeftPrec(), 0);
writer.sep(super.getName());
writer.sep(flag.name());
// If the expression for the lower bound contains a call to an AND
// operator, we need to wrap the expression in parentheses to prevent
// the AND from associating with BETWEEN. For example, we should
// unparse
// a BETWEEN b OR (c AND d) OR e AND f
// as
// a BETWEEN (b OR c AND d) OR e) AND f
// If it were unparsed as
// a BETWEEN b OR c AND d OR e AND f
// then it would be interpreted as
// (a BETWEEN (b OR c) AND d) OR (e AND f)
// which would be wrong.
final SqlNode lower = call.operand(LOWER_OPERAND);
final SqlNode upper = call.operand(UPPER_OPERAND);
int lowerPrec = new AndFinder().containsAnd(lower) ? 100 : 0;
lower.unparse(writer, lowerPrec, lowerPrec);
writer.sep("AND");
upper.unparse(writer, 0, getRightPrec());
writer.endList(frame);
}
Aggregations