Search in sources :

Example 1 with OutputRate

use of io.siddhi.query.api.execution.query.output.ratelimit.OutputRate in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitOutput_rate.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public OutputRate visitOutput_rate(@NotNull SiddhiQLParser.Output_rateContext ctx) {
    if (ctx.SNAPSHOT() != null) {
        SnapshotOutputRate snapshotOutputRate = new SnapshotOutputRate(((TimeConstant) visit(ctx.time_value())).value());
        populateQueryContext(snapshotOutputRate, ctx);
        return snapshotOutputRate;
    } else if (ctx.time_value() != null) {
        TimeOutputRate timeOutputRate = new TimeOutputRate(((TimeConstant) visit(ctx.time_value())).value());
        if (ctx.output_rate_type() != null) {
            timeOutputRate.output((OutputRate.Type) visit(ctx.output_rate_type()));
        }
        populateQueryContext(timeOutputRate, ctx);
        return timeOutputRate;
    } else if (ctx.EVENTS() != null) {
        EventOutputRate eventOutputRate = new EventOutputRate(Integer.parseInt(ctx.INT_LITERAL().getText()));
        if (ctx.output_rate_type() != null) {
            eventOutputRate.output((OutputRate.Type) visit(ctx.output_rate_type()));
        }
        populateQueryContext(eventOutputRate, ctx);
        return eventOutputRate;
    } else {
        throw newSiddhiParserException(ctx);
    }
}
Also used : SnapshotOutputRate(io.siddhi.query.api.execution.query.output.ratelimit.SnapshotOutputRate) ValuePartitionType(io.siddhi.query.api.execution.partition.ValuePartitionType) PartitionType(io.siddhi.query.api.execution.partition.PartitionType) RangePartitionType(io.siddhi.query.api.execution.partition.RangePartitionType) EventOutputRate(io.siddhi.query.api.execution.query.output.ratelimit.EventOutputRate) SnapshotOutputRate(io.siddhi.query.api.execution.query.output.ratelimit.SnapshotOutputRate) EventOutputRate(io.siddhi.query.api.execution.query.output.ratelimit.EventOutputRate) TimeOutputRate(io.siddhi.query.api.execution.query.output.ratelimit.TimeOutputRate) OutputRate(io.siddhi.query.api.execution.query.output.ratelimit.OutputRate) TimeOutputRate(io.siddhi.query.api.execution.query.output.ratelimit.TimeOutputRate) TimeConstant(io.siddhi.query.api.expression.constant.TimeConstant)

Aggregations

PartitionType (io.siddhi.query.api.execution.partition.PartitionType)1 RangePartitionType (io.siddhi.query.api.execution.partition.RangePartitionType)1 ValuePartitionType (io.siddhi.query.api.execution.partition.ValuePartitionType)1 EventOutputRate (io.siddhi.query.api.execution.query.output.ratelimit.EventOutputRate)1 OutputRate (io.siddhi.query.api.execution.query.output.ratelimit.OutputRate)1 SnapshotOutputRate (io.siddhi.query.api.execution.query.output.ratelimit.SnapshotOutputRate)1 TimeOutputRate (io.siddhi.query.api.execution.query.output.ratelimit.TimeOutputRate)1 TimeConstant (io.siddhi.query.api.expression.constant.TimeConstant)1