use of org.wso2.siddhi.query.api.expression.Expression in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitSet_clause.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public UpdateSet visitSet_clause(@NotNull SiddhiQLParser.Set_clauseContext ctx) {
UpdateSet updateSet = new UpdateSet();
for (SiddhiQLParser.Set_assignmentContext setAssignmentContext : ctx.set_assignment()) {
updateSet.set(((Variable) visit(setAssignmentContext.attribute_reference())), (Expression) visit(setAssignmentContext.expression()));
}
populateQueryContext(updateSet, ctx);
return updateSet;
}
use of org.wso2.siddhi.query.api.expression.Expression in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitStore_input.
@Override
public Object visitStore_input(SiddhiQLParser.Store_inputContext ctx) {
String sourceId = (String) visit(ctx.source_id());
String alias = null;
if (ctx.alias() != null) {
alias = (String) visit(ctx.source_id());
}
Store store = InputStore.store(alias, sourceId);
Expression expression = null;
if (ctx.expression() != null) {
expression = (Expression) visit(ctx.expression());
}
populateQueryContext(store, ctx);
if (ctx.per() != null) {
return store.on(expression, (Within) visit(ctx.within_time_range()), (Expression) visit(ctx.per()));
} else if (expression != null) {
return store.on(expression);
} else {
return store;
}
}
use of org.wso2.siddhi.query.api.expression.Expression in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitFilter.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public Filter visitFilter(@NotNull SiddhiQLParser.FilterContext ctx) {
Filter filter = new Filter((Expression) visit(ctx.expression()));
populateQueryContext(filter, ctx);
return filter;
}
use of org.wso2.siddhi.query.api.expression.Expression in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitFunction_operation.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public Object visitFunction_operation(@NotNull SiddhiQLParser.Function_operationContext ctx) {
Expression expression;
if (ctx.function_namespace() != null) {
if (ctx.attribute_list() != null) {
expression = Expression.function((String) visit(ctx.function_namespace()), (String) visit(ctx.function_id()), (Expression[]) visit(ctx.attribute_list()));
} else {
expression = Expression.function((String) visit(ctx.function_namespace()), (String) visit(ctx.function_id()), null);
}
} else {
if (ctx.attribute_list() != null) {
expression = Expression.function((String) visit(ctx.function_id()), (Expression[]) visit(ctx.attribute_list()));
} else {
expression = Expression.function((String) visit(ctx.function_id()), null);
}
}
populateQueryContext(expression, ctx);
return expression;
}
use of org.wso2.siddhi.query.api.expression.Expression in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitAnd_math_operation.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public Expression visitAnd_math_operation(@NotNull SiddhiQLParser.And_math_operationContext ctx) {
if (ctx.AND() != null) {
Expression expression = Expression.and((Expression) visit(ctx.math_operation(0)), (Expression) visit(ctx.math_operation(1)));
populateQueryContext(expression, ctx);
return expression;
} else {
throw newSiddhiParserException(ctx);
}
}
Aggregations