use of org.wso2.siddhi.query.api.expression.constant.TimeConstant in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitDay_value.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public TimeConstant visitDay_value(@NotNull SiddhiQLParser.Day_valueContext ctx) {
TimeConstant timeConstant = Expression.Time.day(Long.parseLong(ctx.INT_LITERAL().getText().replaceFirst("[lL]", "")));
populateQueryContext(timeConstant, ctx);
return timeConstant;
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitMonth_value.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public TimeConstant visitMonth_value(@NotNull SiddhiQLParser.Month_valueContext ctx) {
TimeConstant timeConstant = Expression.Time.month(Long.parseLong(ctx.INT_LITERAL().getText().replaceFirst("[lL]", "")));
populateQueryContext(timeConstant, ctx);
return timeConstant;
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant in project siddhi by wso2.
the class PatternQueryTestCase method testPatternQuery11.
// from e1=Stream1[price >= 30] -> not Stream1[ price >= 20] for 1 sec -> e3=Stream2[ price >= e1.price]
// select e1.symbol, avg(e2.price ) as avgPrice
// group by e1.symbol
// having avgPrice>50;
// insert into OutputStream
@Test
public void testPatternQuery11() {
Query query = Query.query();
query.from(InputStream.patternStream(State.next(State.stream(InputStream.stream("e1", "Stream1").filter(Expression.compare(Expression.variable("price"), Compare.Operator.GREATER_THAN_EQUAL, Expression.value(30)))), State.next(State.logicalNot(State.stream(InputStream.stream("Stream1").filter(Expression.compare(Expression.variable("price"), Compare.Operator.GREATER_THAN_EQUAL, Expression.value(20)))), new TimeConstant(1000)), State.stream(InputStream.stream("e3", "Stream2").filter(Expression.compare(Expression.variable("price"), Compare.Operator.GREATER_THAN_EQUAL, Expression.variable("price").ofStream("e1"))))))));
query.select(Selector.selector().select("symbol", Expression.variable("symbol").ofStream("e1")).select("avgPrice", Expression.function("avg", Expression.variable("price").ofStream("e2"))).groupBy(Expression.variable("symbol").ofStream("e1")).having(Expression.compare(Expression.variable("avgPrice"), Compare.Operator.GREATER_THAN, Expression.value(50))));
query.insertInto("OutputStream");
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitSecond_value.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public TimeConstant visitSecond_value(@NotNull SiddhiQLParser.Second_valueContext ctx) {
TimeConstant timeConstant = Expression.Time.sec(Long.parseLong(ctx.INT_LITERAL().getText().replaceFirst("[lL]", "")));
populateQueryContext(timeConstant, ctx);
return timeConstant;
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitWeek_value.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public TimeConstant visitWeek_value(@NotNull SiddhiQLParser.Week_valueContext ctx) {
TimeConstant timeConstant = Expression.Time.week(Long.parseLong(ctx.INT_LITERAL().getText().replaceFirst("[lL]", "")));
populateQueryContext(timeConstant, ctx);
return timeConstant;
}
Aggregations