Search in sources :

Example 1 with AnonymousInputStream

use of org.wso2.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 : StoreQuery(org.wso2.siddhi.query.api.execution.query.StoreQuery) Query(org.wso2.siddhi.query.api.execution.query.Query) AnonymousInputStream(org.wso2.siddhi.query.api.execution.query.input.stream.AnonymousInputStream) ReturnStream(org.wso2.siddhi.query.api.execution.query.output.stream.ReturnStream)

Aggregations

Query (org.wso2.siddhi.query.api.execution.query.Query)1 StoreQuery (org.wso2.siddhi.query.api.execution.query.StoreQuery)1 AnonymousInputStream (org.wso2.siddhi.query.api.execution.query.input.stream.AnonymousInputStream)1 ReturnStream (org.wso2.siddhi.query.api.execution.query.output.stream.ReturnStream)1