use of org.apache.calcite.sql.SqlWriter in project calcite by apache.
the class SqlCreateView method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
if (getReplace()) {
writer.keyword("CREATE OR REPLACE");
} else {
writer.keyword("CREATE");
}
writer.keyword("VIEW");
name.unparse(writer, leftPrec, rightPrec);
if (columnList != null) {
SqlWriter.Frame frame = writer.startList("(", ")");
for (SqlNode c : columnList) {
writer.sep(",");
c.unparse(writer, 0, 0);
}
writer.endList(frame);
}
writer.keyword("AS");
writer.newlineAndIndent();
query.unparse(writer, 0, 0);
}
use of org.apache.calcite.sql.SqlWriter in project calcite by apache.
the class SqlUploadJarNode method unparseAlterOperation.
@Override
protected void unparseAlterOperation(SqlWriter writer, int leftPrec, int rightPrec) {
writer.keyword("UPLOAD");
writer.keyword("JAR");
SqlWriter.Frame frame = writer.startList("", "");
for (SqlNode jarPath : jarPaths) {
jarPath.unparse(writer, leftPrec, rightPrec);
}
writer.endList(frame);
}
use of org.apache.calcite.sql.SqlWriter in project flink by apache.
the class SqlAlterHiveTableAddReplaceColumn method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
writer.keyword("ALTER TABLE");
tableIdentifier.unparse(writer, leftPrec, rightPrec);
SqlNodeList partitionSpec = getPartitionSpec();
if (partitionSpec != null && partitionSpec.size() > 0) {
writer.keyword("PARTITION");
partitionSpec.unparse(writer, getOperator().getLeftPrec(), getOperator().getRightPrec());
}
if (isReplace()) {
writer.keyword("REPLACE");
} else {
writer.keyword("ADD");
}
writer.keyword("COLUMNS");
SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.create("sds"), "(", ")");
for (SqlNode column : origColumns) {
printIndent(writer);
column.unparse(writer, leftPrec, rightPrec);
}
writer.newlineAndIndent();
writer.endList(frame);
if (cascade) {
writer.keyword("CASCADE");
} else {
writer.keyword("RESTRICT");
}
}
use of org.apache.calcite.sql.SqlWriter in project flink by apache.
the class SqlAlterHiveTableProps method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
super.unparse(writer, leftPrec, rightPrec);
writer.keyword("SET TBLPROPERTIES");
SqlWriter.Frame withFrame = writer.startList("(", ")");
for (SqlNode property : origProps) {
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 SqlAlterHiveTableSerDe method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
super.unparse(writer, leftPrec, rightPrec);
writer.keyword("SET");
if (serdeLib != null) {
writer.keyword("SERDE");
serdeLib.unparse(writer, leftPrec, rightPrec);
}
if (origSerDeProps != null && origSerDeProps.size() > 0) {
if (serdeLib == null) {
writer.keyword("SERDEPROPERTIES");
} else {
writer.keyword("WITH SERDEPROPERTIES");
}
SqlWriter.Frame withFrame = writer.startList("(", ")");
for (SqlNode property : origSerDeProps) {
printIndent(writer);
property.unparse(writer, leftPrec, rightPrec);
}
writer.newlineAndIndent();
writer.endList(withFrame);
}
}
Aggregations