Search in sources :

Example 1 with SnapshotOutputRate

use of org.wso2.siddhi.query.api.execution.query.output.ratelimit.SnapshotOutputRate 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(org.wso2.siddhi.query.api.execution.query.output.ratelimit.SnapshotOutputRate) PartitionType(org.wso2.siddhi.query.api.execution.partition.PartitionType) RangePartitionType(org.wso2.siddhi.query.api.execution.partition.RangePartitionType) ValuePartitionType(org.wso2.siddhi.query.api.execution.partition.ValuePartitionType) EventOutputRate(org.wso2.siddhi.query.api.execution.query.output.ratelimit.EventOutputRate) TimeOutputRate(org.wso2.siddhi.query.api.execution.query.output.ratelimit.TimeOutputRate) EventOutputRate(org.wso2.siddhi.query.api.execution.query.output.ratelimit.EventOutputRate) OutputRate(org.wso2.siddhi.query.api.execution.query.output.ratelimit.OutputRate) SnapshotOutputRate(org.wso2.siddhi.query.api.execution.query.output.ratelimit.SnapshotOutputRate) TimeOutputRate(org.wso2.siddhi.query.api.execution.query.output.ratelimit.TimeOutputRate) TimeConstant(org.wso2.siddhi.query.api.expression.constant.TimeConstant)

Aggregations

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