Search in sources :

Example 1 with Select

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());
}
Also used : QuerySpecification(io.confluent.ksql.parser.tree.QuerySpecification) Relation(io.confluent.ksql.parser.tree.Relation) AliasedRelation(io.confluent.ksql.parser.tree.AliasedRelation) DropTable(io.confluent.ksql.parser.tree.DropTable) Table(io.confluent.ksql.parser.tree.Table) CreateTable(io.confluent.ksql.parser.tree.CreateTable) SimpleGroupBy(io.confluent.ksql.parser.tree.SimpleGroupBy) GroupBy(io.confluent.ksql.parser.tree.GroupBy) InListExpression(io.confluent.ksql.parser.tree.InListExpression) NullIfExpression(io.confluent.ksql.parser.tree.NullIfExpression) SimpleCaseExpression(io.confluent.ksql.parser.tree.SimpleCaseExpression) ComparisonExpression(io.confluent.ksql.parser.tree.ComparisonExpression) DereferenceExpression(io.confluent.ksql.parser.tree.DereferenceExpression) Expression(io.confluent.ksql.parser.tree.Expression) LogicalBinaryExpression(io.confluent.ksql.parser.tree.LogicalBinaryExpression) TumblingWindowExpression(io.confluent.ksql.parser.tree.TumblingWindowExpression) ArithmeticBinaryExpression(io.confluent.ksql.parser.tree.ArithmeticBinaryExpression) NotExpression(io.confluent.ksql.parser.tree.NotExpression) HoppingWindowExpression(io.confluent.ksql.parser.tree.HoppingWindowExpression) SubscriptExpression(io.confluent.ksql.parser.tree.SubscriptExpression) SessionWindowExpression(io.confluent.ksql.parser.tree.SessionWindowExpression) SearchedCaseExpression(io.confluent.ksql.parser.tree.SearchedCaseExpression) LambdaExpression(io.confluent.ksql.parser.tree.LambdaExpression) SubqueryExpression(io.confluent.ksql.parser.tree.SubqueryExpression) WindowExpression(io.confluent.ksql.parser.tree.WindowExpression) ArithmeticUnaryExpression(io.confluent.ksql.parser.tree.ArithmeticUnaryExpression) SelectItem(io.confluent.ksql.parser.tree.SelectItem) TumblingWindowExpression(io.confluent.ksql.parser.tree.TumblingWindowExpression) HoppingWindowExpression(io.confluent.ksql.parser.tree.HoppingWindowExpression) SessionWindowExpression(io.confluent.ksql.parser.tree.SessionWindowExpression) WindowExpression(io.confluent.ksql.parser.tree.WindowExpression) CreateTableAsSelect(io.confluent.ksql.parser.tree.CreateTableAsSelect) CreateStreamAsSelect(io.confluent.ksql.parser.tree.CreateStreamAsSelect) Select(io.confluent.ksql.parser.tree.Select)

Aggregations

AliasedRelation (io.confluent.ksql.parser.tree.AliasedRelation)1 ArithmeticBinaryExpression (io.confluent.ksql.parser.tree.ArithmeticBinaryExpression)1 ArithmeticUnaryExpression (io.confluent.ksql.parser.tree.ArithmeticUnaryExpression)1 ComparisonExpression (io.confluent.ksql.parser.tree.ComparisonExpression)1 CreateStreamAsSelect (io.confluent.ksql.parser.tree.CreateStreamAsSelect)1 CreateTable (io.confluent.ksql.parser.tree.CreateTable)1 CreateTableAsSelect (io.confluent.ksql.parser.tree.CreateTableAsSelect)1 DereferenceExpression (io.confluent.ksql.parser.tree.DereferenceExpression)1 DropTable (io.confluent.ksql.parser.tree.DropTable)1 Expression (io.confluent.ksql.parser.tree.Expression)1 GroupBy (io.confluent.ksql.parser.tree.GroupBy)1 HoppingWindowExpression (io.confluent.ksql.parser.tree.HoppingWindowExpression)1 InListExpression (io.confluent.ksql.parser.tree.InListExpression)1 LambdaExpression (io.confluent.ksql.parser.tree.LambdaExpression)1 LogicalBinaryExpression (io.confluent.ksql.parser.tree.LogicalBinaryExpression)1 NotExpression (io.confluent.ksql.parser.tree.NotExpression)1 NullIfExpression (io.confluent.ksql.parser.tree.NullIfExpression)1 QuerySpecification (io.confluent.ksql.parser.tree.QuerySpecification)1 Relation (io.confluent.ksql.parser.tree.Relation)1 SearchedCaseExpression (io.confluent.ksql.parser.tree.SearchedCaseExpression)1