use of org.apache.calcite.sql.SqlWriter in project calcite by apache.
the class SqlMultisetValueConstructor method unparse.
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
// "MULTISET" or "ARRAY"
writer.keyword(getName());
final SqlWriter.Frame frame = writer.startList("[", "]");
for (SqlNode operand : call.getOperandList()) {
writer.sep(",");
operand.unparse(writer, leftPrec, rightPrec);
}
writer.endList(frame);
}
use of org.apache.calcite.sql.SqlWriter in project calcite by apache.
the class SqlColumnListConstructor method unparse.
// ~ Methods ----------------------------------------------------------------
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
writer.keyword("ROW");
final SqlWriter.Frame frame = writer.startList("(", ")");
for (SqlNode operand : call.getOperandList()) {
writer.sep(",");
operand.unparse(writer, leftPrec, rightPrec);
}
writer.endList(frame);
}
use of org.apache.calcite.sql.SqlWriter in project calcite by apache.
the class SqlExtendOperator method unparse.
@Override
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
final SqlOperator operator = call.getOperator();
assert call.operandCount() == 2;
final SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.SIMPLE);
call.operand(0).unparse(writer, leftPrec, operator.getLeftPrec());
writer.setNeedWhitespace(true);
writer.sep(operator.getName());
final SqlNodeList list = call.operand(1);
final SqlWriter.Frame frame2 = writer.startList("(", ")");
for (Ord<SqlNode> node2 : Ord.zip(list)) {
if (node2.i > 0 && node2.i % 2 == 0) {
writer.sep(",");
}
node2.e.unparse(writer, 2, 3);
}
writer.endList(frame2);
writer.endList(frame);
}
use of org.apache.calcite.sql.SqlWriter in project calcite by apache.
the class SqlRollupOperator method unparseCube.
private static void unparseCube(SqlWriter writer, SqlCall call) {
writer.keyword(call.getOperator().getName());
final SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.FUN_CALL, "(", ")");
for (SqlNode operand : call.getOperandList()) {
writer.sep(",");
if (operand.getKind() == SqlKind.ROW) {
final SqlWriter.Frame frame2 = writer.startList(SqlWriter.FrameTypeEnum.SIMPLE, "(", ")");
for (SqlNode operand2 : ((SqlCall) operand).getOperandList()) {
writer.sep(",");
operand2.unparse(writer, 0, 0);
}
writer.endList(frame2);
} else if (operand instanceof SqlNodeList && ((SqlNodeList) operand).size() == 0) {
writer.keyword("()");
} else {
operand.unparse(writer, 0, 0);
}
}
writer.endList(frame);
}
use of org.apache.calcite.sql.SqlWriter in project calcite by apache.
the class SqlTranslate3Function method unparse.
// ~ Methods ----------------------------------------------------------------
@Override
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
final SqlWriter.Frame frame = writer.startFunCall("TRANSLATE");
for (SqlNode sqlNode : call.getOperandList()) {
writer.sep(",");
sqlNode.unparse(writer, leftPrec, rightPrec);
}
writer.endFunCall(frame);
}
Aggregations