use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project calcite by apache.
the class SqlCreateMaterializedView method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
writer.keyword("CREATE");
writer.keyword("MATERIALIZED VIEW");
if (ifNotExists) {
writer.keyword("IF NOT EXISTS");
}
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.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlWriter in project calcite by apache.
the class MssqlSqlDialect method unparseSqlDatetimeArithmetic.
@Override
public void unparseSqlDatetimeArithmetic(SqlWriter writer, SqlCall call, SqlKind sqlKind, int leftPrec, int rightPrec) {
final SqlWriter.Frame frame = writer.startFunCall("DATEADD");
SqlNode operand = call.operand(1);
if (operand instanceof SqlIntervalLiteral) {
// There is no DATESUB method available, so change the sign.
unparseSqlIntervalLiteralMssql(writer, (SqlIntervalLiteral) operand, sqlKind == SqlKind.MINUS ? -1 : 1);
} else {
operand.unparse(writer, leftPrec, rightPrec);
}
writer.sep(",", true);
call.operand(0).unparse(writer, leftPrec, rightPrec);
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 SqlAlterHiveDatabaseProps method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
super.unparse(writer, leftPrec, rightPrec);
writer.keyword("DBPROPERTIES");
SqlWriter.Frame withFrame = writer.startList("(", ")");
for (SqlNode property : originPropList) {
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 SqlAlterHiveViewProperties method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
writer.keyword("ALTER VIEW");
viewIdentifier.unparse(writer, leftPrec, rightPrec);
writer.keyword("SET TBLPROPERTIES");
SqlWriter.Frame withFrame = writer.startList("(", ")");
for (SqlNode property : getPropertyList()) {
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 SqlCreateHiveTable method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
writer.keyword("CREATE");
if (isTemporary()) {
writer.keyword("TEMPORARY");
}
if (isExternal) {
writer.keyword("EXTERNAL");
}
writer.keyword("TABLE");
if (ifNotExists) {
writer.keyword("IF NOT EXISTS");
}
getTableName().unparse(writer, leftPrec, rightPrec);
// columns
SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.create("sds"), "(", ")");
unparseColumns(creationContext, origColList, writer, leftPrec, rightPrec);
for (SqlTableConstraint tableConstraint : creationContext.constraints) {
printIndent(writer);
tableConstraint.getConstraintNameIdentifier().ifPresent(name -> {
writer.keyword("CONSTRAINT");
name.unparse(writer, leftPrec, rightPrec);
});
writer.keyword("PRIMARY KEY");
SqlWriter.Frame pkFrame = writer.startList("(", ")");
tableConstraint.getColumns().unparse(writer, leftPrec, rightPrec);
writer.endList(pkFrame);
creationContext.pkTrait.unparse(writer, leftPrec, rightPrec);
}
writer.newlineAndIndent();
writer.endList(frame);
// table comment
getComment().ifPresent(c -> {
writer.keyword("COMMENT");
c.unparse(writer, leftPrec, rightPrec);
});
// partitions
if (origPartColList.size() > 0) {
writer.newlineAndIndent();
writer.keyword("PARTITIONED BY");
SqlWriter.Frame partitionedByFrame = writer.startList("(", ")");
unparseColumns(creationContext, origPartColList, writer, leftPrec, rightPrec);
writer.newlineAndIndent();
writer.endList(partitionedByFrame);
}
// row format
unparseRowFormat(writer, leftPrec, rightPrec);
// stored as
unparseStoredAs(writer, leftPrec, rightPrec);
// location
if (location != null) {
writer.newlineAndIndent();
writer.keyword("LOCATION");
location.unparse(writer, leftPrec, rightPrec);
}
// properties
if (originPropList.size() > 0) {
writer.newlineAndIndent();
writer.keyword("TBLPROPERTIES");
unparsePropList(originPropList, writer, leftPrec, rightPrec);
}
}
Aggregations