Search in sources :

Example 1 with AnonymousInputStream

use of io.siddhi.query.api.execution.query.input.stream.AnonymousInputStream in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitAnonymous_stream.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public AnonymousInputStream visitAnonymous_stream(@NotNull SiddhiQLParser.Anonymous_streamContext ctx) {
    if (ctx.anonymous_stream() != null) {
        return (AnonymousInputStream) visit(ctx.anonymous_stream());
    }
    Set<String> activeStreamsBackup = activeStreams;
    try {
        activeStreams = new HashSet<String>();
        Query query = Query.query().from((InputStream) visit(ctx.query_input()));
        if (ctx.query_section() != null) {
            query.select((Selector) visit(ctx.query_section()));
        }
        if (ctx.output_rate() != null) {
            query.output((OutputRate) visit(ctx.output_rate()));
        }
        if (ctx.output_event_type() != null) {
            query.outStream(new ReturnStream((OutputStream.OutputEventType) visit(ctx.output_event_type())));
        } else {
            query.outStream(new ReturnStream());
        }
        AnonymousInputStream anonymousInputStream = new AnonymousInputStream(query);
        populateQueryContext(anonymousInputStream, ctx);
        return anonymousInputStream;
    } finally {
        activeStreams.clear();
        activeStreams = activeStreamsBackup;
    }
}
Also used : Query(io.siddhi.query.api.execution.query.Query) OnDemandQuery(io.siddhi.query.api.execution.query.OnDemandQuery) AnonymousInputStream(io.siddhi.query.api.execution.query.input.stream.AnonymousInputStream) ReturnStream(io.siddhi.query.api.execution.query.output.stream.ReturnStream)

Aggregations

OnDemandQuery (io.siddhi.query.api.execution.query.OnDemandQuery)1 Query (io.siddhi.query.api.execution.query.Query)1 AnonymousInputStream (io.siddhi.query.api.execution.query.input.stream.AnonymousInputStream)1 ReturnStream (io.siddhi.query.api.execution.query.output.stream.ReturnStream)1