use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project hazelcast by hazelcast.
the class SqlCreateMapping method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
writer.keyword("CREATE");
if (getReplace()) {
writer.keyword("OR REPLACE");
}
writer.keyword("EXTERNAL MAPPING");
if (ifNotExists) {
writer.keyword("IF NOT EXISTS");
}
name.unparse(writer, leftPrec, rightPrec);
if (externalName != null) {
writer.keyword("EXTERNAL NAME");
externalName.unparse(writer, leftPrec, rightPrec);
}
if (columns.size() > 0) {
SqlWriter.Frame frame = writer.startList("(", ")");
for (SqlNode column : columns) {
printIndent(writer);
column.unparse(writer, 0, 0);
}
writer.newlineAndIndent();
writer.endList(frame);
}
writer.newlineAndIndent();
writer.keyword("TYPE");
type.unparse(writer, leftPrec, rightPrec);
if (options.size() > 0) {
writer.newlineAndIndent();
writer.keyword("OPTIONS");
SqlWriter.Frame withFrame = writer.startList("(", ")");
for (SqlNode property : options) {
printIndent(writer);
property.unparse(writer, leftPrec, rightPrec);
}
writer.newlineAndIndent();
writer.endList(withFrame);
}
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project hazelcast by hazelcast.
the class HazelcastValuesOperator method unparse.
@Override
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.VALUES, "VALUES", "");
for (SqlNode operand : call.getOperandList()) {
writer.sep(",");
operand.unparse(writer, 0, 0);
}
writer.endList(frame);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project hazelcast by hazelcast.
the class HazelcastMapValueConstructor method unparse.
@Override
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
writer.keyword(getName());
SqlWriter.Frame frame = writer.startList("[", "]");
for (SqlNode operand : call.getOperandList()) {
writer.sep(",");
operand.unparse(writer, leftPrec, rightPrec);
}
writer.endList(frame);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project hazelcast by hazelcast.
the class HazelcastJsonArrayFunction method unparse.
@Override
public void unparse(final SqlWriter writer, final SqlCall call, final int leftPrec, final int rightPrec) {
final SqlWriter.Frame frame = writer.startFunCall(this.getName());
if (call.operandCount() == 1) {
writer.endFunCall(frame);
return;
}
for (int i = 1; i < call.operandCount(); i++) {
writer.sep(",");
call.operand(i).unparse(writer, leftPrec, rightPrec);
}
final SqlJsonConstructorNullClause nullClause = (SqlJsonConstructorNullClause) ((SqlLiteral) call.operand(0)).getValue();
switch(nullClause) {
case ABSENT_ON_NULL:
writer.keyword("ABSENT ON NULL");
break;
case NULL_ON_NULL:
writer.keyword("NULL ON NULL");
break;
default:
throw QueryException.error("Unknown SqlJsonConstructorNullClause constant: " + nullClause);
}
writer.endFunCall(frame);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project hazelcast by hazelcast.
the class HazelcastJsonObjectFunction method unparse.
@Override
public void unparse(final SqlWriter writer, final SqlCall call, final int leftPrec, final int rightPrec) {
final SqlWriter.Frame frame = writer.startFunCall(this.getName());
if (call.operandCount() == 1) {
writer.endFunCall(frame);
return;
}
for (int i = 1; i < call.operandCount(); i += 2) {
writer.sep(",");
writer.keyword("KEY");
call.operand(i).unparse(writer, leftPrec, rightPrec);
writer.keyword("VALUE");
call.operand(i + 1).unparse(writer, leftPrec, rightPrec);
}
final SqlJsonConstructorNullClause nullClause = (SqlJsonConstructorNullClause) ((SqlLiteral) call.operand(0)).getValue();
switch(nullClause) {
case ABSENT_ON_NULL:
writer.keyword("ABSENT ON NULL");
break;
case NULL_ON_NULL:
writer.keyword("NULL ON NULL");
break;
default:
throw QueryException.error("Unknown SqlJsonConstructorNullClause constant: " + nullClause);
}
writer.endFunCall(frame);
}
Aggregations