Search in sources :

Example 1 with InputStream

use of org.ballerinalang.siddhi.query.api.execution.query.input.stream.InputStream in project ballerina by ballerina-lang.

the class SiddhiQLBaseVisitorImpl method visitJoin_stream.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public Object visitJoin_stream(@NotNull SiddhiQLParser.Join_streamContext ctx) {
    // join_stream
    // :left_source=join_source join right_source=join_source right_unidirectional=UNIDIRECTIONAL (ON expression)?
    // within_time?
    // |left_source=join_source join right_source=join_source (ON expression)? within_time?
    // |left_source=join_source left_unidirectional=UNIDIRECTIONAL join right_source=join_source (ON expression)?
    // within_time?
    // ;
    SingleInputStream leftStream = (SingleInputStream) visit(ctx.left_source);
    SingleInputStream rightStream = (SingleInputStream) visit(ctx.right_source);
    JoinInputStream.Type joinType = (JoinInputStream.Type) visit(ctx.join());
    JoinInputStream.EventTrigger eventTrigger = null;
    Expression onCondition = null;
    Within within = null;
    Expression per = null;
    if (ctx.within_time_range() != null) {
        within = (Within) visit(ctx.within_time_range());
    }
    if (ctx.per() != null) {
        per = (Expression) visit(ctx.per());
    }
    if (ctx.expression() != null) {
        onCondition = (Expression) visit(ctx.expression());
    }
    if (ctx.right_unidirectional != null) {
        eventTrigger = JoinInputStream.EventTrigger.RIGHT;
    } else if (ctx.left_unidirectional != null) {
        eventTrigger = JoinInputStream.EventTrigger.LEFT;
    } else {
        eventTrigger = JoinInputStream.EventTrigger.ALL;
    }
    InputStream inputStream = InputStream.joinStream(leftStream, joinType, rightStream, onCondition, eventTrigger, within, per);
    populateQueryContext(inputStream, ctx);
    return inputStream;
}
Also used : RangePartitionType(org.ballerinalang.siddhi.query.api.execution.partition.RangePartitionType) ValuePartitionType(org.ballerinalang.siddhi.query.api.execution.partition.ValuePartitionType) PartitionType(org.ballerinalang.siddhi.query.api.execution.partition.PartitionType) Expression(org.ballerinalang.siddhi.query.api.expression.Expression) BasicSingleInputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream) SingleInputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.SingleInputStream) JoinInputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.JoinInputStream) InputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.InputStream) BasicSingleInputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream) SingleInputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.SingleInputStream) JoinInputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.JoinInputStream) AnonymousInputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.AnonymousInputStream) StateInputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.StateInputStream) Within(org.ballerinalang.siddhi.query.api.aggregation.Within)

Aggregations

Within (org.ballerinalang.siddhi.query.api.aggregation.Within)1 PartitionType (org.ballerinalang.siddhi.query.api.execution.partition.PartitionType)1 RangePartitionType (org.ballerinalang.siddhi.query.api.execution.partition.RangePartitionType)1 ValuePartitionType (org.ballerinalang.siddhi.query.api.execution.partition.ValuePartitionType)1 AnonymousInputStream (org.ballerinalang.siddhi.query.api.execution.query.input.stream.AnonymousInputStream)1 BasicSingleInputStream (org.ballerinalang.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream)1 InputStream (org.ballerinalang.siddhi.query.api.execution.query.input.stream.InputStream)1 JoinInputStream (org.ballerinalang.siddhi.query.api.execution.query.input.stream.JoinInputStream)1 SingleInputStream (org.ballerinalang.siddhi.query.api.execution.query.input.stream.SingleInputStream)1 StateInputStream (org.ballerinalang.siddhi.query.api.execution.query.input.stream.StateInputStream)1 Expression (org.ballerinalang.siddhi.query.api.expression.Expression)1