use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project flink by apache.
the class SqlCreateHiveTable method unparsePropList.
private void unparsePropList(SqlNodeList propList, SqlWriter writer, int leftPrec, int rightPrec) {
SqlWriter.Frame withFrame = writer.startList("(", ")");
for (SqlNode property : propList) {
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 flink by apache.
the class SqlAddReplaceColumns method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
super.unparse(writer, leftPrec, rightPrec);
if (replace) {
writer.keyword("REPLACE");
} else {
writer.keyword("ADD");
}
writer.keyword("COLUMNS");
SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.create("sds"), "(", ")");
for (SqlNode column : newColumns) {
printIndent(writer);
column.unparse(writer, leftPrec, rightPrec);
}
writer.newlineAndIndent();
writer.endList(frame);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project flink by apache.
the class SqlDropPartitions method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
super.unparse(writer, leftPrec, rightPrec);
writer.newlineAndIndent();
writer.keyword("DROP");
if (ifExists) {
writer.keyword("IF EXISTS");
}
int opLeftPrec = getOperator().getLeftPrec();
int opRightPrec = getOperator().getRightPrec();
final SqlWriter.Frame frame = writer.startList("", "");
for (SqlNodeList partSpec : partSpecs) {
writer.sep(",");
writer.newlineAndIndent();
writer.keyword("PARTITION");
partSpec.unparse(writer, opLeftPrec, opRightPrec);
}
writer.endList(frame);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project flink by apache.
the class SqlCreateCatalog method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
writer.keyword("CREATE CATALOG");
catalogName.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.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project flink by apache.
the class SqlJsonObjectFunction method unparse.
@Override
public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
assert call.operandCount() % 2 == 1;
final SqlWriter.Frame frame = writer.startFunCall(getName());
SqlWriter.Frame listFrame = writer.startList("", "");
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);
}
writer.endList(listFrame);
SqlJsonConstructorNullClause nullClause = getEnumValue(call.operand(0));
switch(nullClause) {
case ABSENT_ON_NULL:
writer.keyword("ABSENT ON NULL");
break;
case NULL_ON_NULL:
writer.keyword("NULL ON NULL");
break;
default:
throw new IllegalStateException("unreachable code");
}
writer.endFunCall(frame);
}
Aggregations