Java Code Examples for org.apache.calcite.sql.SqlNodeList#unparse()
The following examples show how to use
org.apache.calcite.sql.SqlNodeList#unparse() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SqlAlterHiveTableChangeColumn.java From flink with Apache License 2.0 | 6 votes |
@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()); } writer.keyword("CHANGE COLUMN"); getOldName().unparse(writer, leftPrec, rightPrec); origNewColumn.unparse(writer, leftPrec, rightPrec); if (isFirst()) { writer.keyword("FIRST"); } if (getAfter() != null) { writer.keyword("AFTER"); getAfter().unparse(writer, leftPrec, rightPrec); } if (cascade) { writer.keyword("CASCADE"); } else { writer.keyword("RESTRICT"); } }
Example 2
Source File: SqlAddHivePartitions.java From flink with Apache License 2.0 | 6 votes |
@Override public void unparse(SqlWriter writer, int leftPrec, int rightPrec) { writer.keyword("ALTER TABLE"); tableIdentifier.unparse(writer, leftPrec, rightPrec); writer.newlineAndIndent(); writer.keyword("ADD"); if (ifNotExists()) { writer.keyword("IF NOT EXISTS"); } int opLeftPrec = getOperator().getLeftPrec(); int opRightPrec = getOperator().getRightPrec(); for (int i = 0; i < getPartSpecs().size(); i++) { writer.newlineAndIndent(); SqlNodeList partSpec = getPartSpecs().get(i); writer.keyword("PARTITION"); partSpec.unparse(writer, opLeftPrec, opRightPrec); SqlCharStringLiteral location = partLocations.get(i); if (location != null) { writer.keyword("LOCATION"); location.unparse(writer, opLeftPrec, opRightPrec); } } }
Example 3
Source File: SqlAddPartitions.java From flink with Apache License 2.0 | 6 votes |
@Override public void unparse(SqlWriter writer, int leftPrec, int rightPrec) { super.unparse(writer, leftPrec, rightPrec); writer.newlineAndIndent(); writer.keyword("ADD"); if (ifNotExists) { writer.keyword("IF NOT EXISTS"); } int opLeftPrec = getOperator().getLeftPrec(); int opRightPrec = getOperator().getRightPrec(); for (int i = 0; i < partSpecs.size(); i++) { writer.newlineAndIndent(); SqlNodeList partSpec = partSpecs.get(i); SqlNodeList partProp = partProps.get(i); writer.keyword("PARTITION"); partSpec.unparse(writer, opLeftPrec, opRightPrec); if (partProp != null) { writer.keyword("WITH"); partProp.unparse(writer, opLeftPrec, opRightPrec); } } }
Example 4
Source File: SqlDropPartitions.java From flink with Apache License 2.0 | 6 votes |
@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(); for (SqlNodeList partSpec : partSpecs) { writer.newlineAndIndent(); writer.keyword("PARTITION"); partSpec.unparse(writer, opLeftPrec, opRightPrec); } }
Example 5
Source File: SqlAlterHiveTable.java From flink with Apache License 2.0 | 5 votes |
@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()); } }
Example 6
Source File: SqlAlterHiveTableAddReplaceColumn.java From flink with Apache License 2.0 | 5 votes |
@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"); } }
Example 7
Source File: SqlAlterTable.java From flink with Apache License 2.0 | 5 votes |
@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()); } }