use of org.apache.calcite.sql.SqlNodeList in project flink by apache.
the class SqlCreateHiveTable method extractPartColIdentifiers.
// Extract the identifiers from partition col list -- that's what SqlCreateTable expects for
// partition keys
private static SqlNodeList extractPartColIdentifiers(SqlNodeList partCols) {
if (partCols == null) {
return null;
}
SqlNodeList res = new SqlNodeList(partCols.getParserPosition());
for (SqlNode node : partCols) {
SqlTableColumn partCol = (SqlTableColumn) node;
res.add(partCol.getName());
}
return res;
}
use of org.apache.calcite.sql.SqlNodeList in project flink by apache.
the class SqlAlterHiveTableChangeColumn 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());
}
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");
}
}
use of org.apache.calcite.sql.SqlNodeList in project flink by apache.
the class SqlAlterHiveTableLocation method createPropList.
private static SqlNodeList createPropList(SqlCharStringLiteral location) {
SqlNodeList res = new SqlNodeList(location.getParserPosition());
res.add(HiveDDLUtils.toTableOption(SqlCreateHiveTable.TABLE_LOCATION_URI, location, location.getParserPosition()));
return res;
}
use of org.apache.calcite.sql.SqlNodeList in project flink by apache.
the class SqlShowPartitions method unparse.
@Override
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
writer.keyword("SHOW PARTITIONS");
tableIdentifier.unparse(writer, leftPrec, rightPrec);
SqlNodeList partitionSpec = getPartitionSpec();
if (partitionSpec != null && partitionSpec.size() > 0) {
writer.keyword("PARTITION");
partitionSpec.unparse(writer, getOperator().getLeftPrec(), getOperator().getRightPrec());
}
}
use of org.apache.calcite.sql.SqlNodeList in project flink by apache.
the class SqlAlterTable 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());
}
}
Aggregations