Search in sources :

Example 1 with HoppingWindowExpression

use of io.confluent.ksql.parser.tree.HoppingWindowExpression in project ksql by confluentinc.

the class AstBuilder method visitWindowExpression.

@Override
public Node visitWindowExpression(SqlBaseParser.WindowExpressionContext ctx) {
    String windowName = DEFAULT_WINDOW_NAME;
    if (ctx.IDENTIFIER() != null) {
        windowName = ctx.IDENTIFIER().getText();
    }
    windowName = windowName.toUpperCase();
    if (ctx.tumblingWindowExpression() != null) {
        TumblingWindowExpression tumblingWindowExpression = (TumblingWindowExpression) visitTumblingWindowExpression(ctx.tumblingWindowExpression());
        return new WindowExpression(windowName, tumblingWindowExpression);
    } else if (ctx.hoppingWindowExpression() != null) {
        HoppingWindowExpression hoppingWindowExpression = (HoppingWindowExpression) visitHoppingWindowExpression(ctx.hoppingWindowExpression());
        return new WindowExpression(windowName, hoppingWindowExpression);
    } else if (ctx.sessionWindowExpression() != null) {
        SessionWindowExpression sessionWindowExpression = (SessionWindowExpression) visitSessionWindowExpression(ctx.sessionWindowExpression());
        return new WindowExpression(windowName, sessionWindowExpression);
    }
    throw new KsqlException("Window description is not correct.");
}
Also used : HoppingWindowExpression(io.confluent.ksql.parser.tree.HoppingWindowExpression) 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) KsqlException(io.confluent.ksql.util.KsqlException) SessionWindowExpression(io.confluent.ksql.parser.tree.SessionWindowExpression) TumblingWindowExpression(io.confluent.ksql.parser.tree.TumblingWindowExpression)

Aggregations

HoppingWindowExpression (io.confluent.ksql.parser.tree.HoppingWindowExpression)1 SessionWindowExpression (io.confluent.ksql.parser.tree.SessionWindowExpression)1 TumblingWindowExpression (io.confluent.ksql.parser.tree.TumblingWindowExpression)1 WindowExpression (io.confluent.ksql.parser.tree.WindowExpression)1 KsqlException (io.confluent.ksql.util.KsqlException)1