use of io.confluent.ksql.parser.tree.Select in project ksql by confluentinc.
the class AstBuilder method visitQuerySpecification.
@Override
public Node visitQuerySpecification(SqlBaseParser.QuerySpecificationContext context) {
Table into;
if (context.into != null) {
into = (Table) visit(context.into);
} else {
// TODO: Generate a unique name
String intoName = "KSQL_Stream_" + System.currentTimeMillis();
into = new Table(QualifiedName.of(intoName), true);
}
Relation from = (Relation) visit(context.from);
Select select = new Select(getLocation(context.SELECT()), false, visit(context.selectItem(), SelectItem.class));
select = new Select(getLocation(context.SELECT()), select.isDistinct(), extractSelectItems(select, from));
getResultDatasource(select, into);
return new QuerySpecification(getLocation(context), select, into, from, visitIfPresent(context.windowExpression(), WindowExpression.class), visitIfPresent(context.where, Expression.class), visitIfPresent(context.groupBy(), GroupBy.class), visitIfPresent(context.having, Expression.class), Optional.<String>empty());
}
Aggregations