use of org.apache.calcite.sql.SqlNodeList in project drill by apache.
the class AnalyzeTableHandler method getColumnList.
/* Generates the column list specified in the ANALYZE statement */
private SqlNodeList getColumnList(final SqlAnalyzeTable sqlAnalyzeTable) {
SqlNodeList columnList = sqlAnalyzeTable.getFieldList();
if (columnList == null || columnList.size() <= 0) {
columnList = new SqlNodeList(SqlParserPos.ZERO);
columnList.add(new SqlIdentifier(SchemaPath.STAR_COLUMN.rootName(), SqlParserPos.ZERO));
}
/*final SqlNodeList columnList = new SqlNodeList(SqlParserPos.ZERO);
final List<String> fields = sqlAnalyzeTable.getFieldNames();
if (fields == null || fields.size() <= 0) {
columnList.add(new SqlIdentifier(SchemaPath.STAR_COLUMN.rootName(), SqlParserPos.ZERO));
} else {
for(String field : fields) {
columnList.add(new SqlIdentifier(field, SqlParserPos.ZERO));
}
}*/
return columnList;
}
use of org.apache.calcite.sql.SqlNodeList in project flink by apache.
the class SqlAddHivePartitions method unparse.
@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);
}
}
}
use of org.apache.calcite.sql.SqlNodeList in project flink by apache.
the class SqlAlterHiveTable 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());
}
}
use of org.apache.calcite.sql.SqlNodeList in project flink by apache.
the class SqlAddPartitions method unparse.
@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);
}
}
}
use of org.apache.calcite.sql.SqlNodeList 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);
}
Aggregations