use of io.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 io.siddhi.query.api.expression.Expression in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitStore_query_output.
/**
* {@inheritDoc}
* <p>
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override
public OutputStream visitStore_query_output(@NotNull SiddhiQLParser.Store_query_outputContext ctx) {
if (ctx.DELETE() != null) {
Source source = (Source) visit(ctx.target());
if (source.isInnerStream || source.isFaultStream) {
throw newSiddhiParserException(ctx, "DELETE can be only used with Tables!");
}
Expression expression = null;
if (ctx.expression() != null) {
expression = (Expression) visit(ctx.expression());
}
OutputStream outputStream = new DeleteStream(source.streamId, expression);
populateQueryContext(outputStream, ctx);
return outputStream;
} else if (ctx.UPDATE() != null) {
Source source = (Source) visit(ctx.target());
if (source.isInnerStream || source.isFaultStream) {
throw newSiddhiParserException(ctx, "DELETE can be only used with Tables!");
}
if (ctx.set_clause() != null) {
OutputStream outputStream = new UpdateStream(source.streamId, (UpdateSet) visit(ctx.set_clause()), (Expression) visit(ctx.expression()));
populateQueryContext(outputStream, ctx);
return outputStream;
} else {
OutputStream outputStream = new UpdateStream(source.streamId, (Expression) visit(ctx.expression()));
populateQueryContext(outputStream, ctx);
return outputStream;
}
} else {
throw newSiddhiParserException(ctx);
}
}
use of io.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 io.siddhi.query.api.expression.Expression in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitIn_math_operation.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public Object visitIn_math_operation(@NotNull SiddhiQLParser.In_math_operationContext ctx) {
Expression expression = Expression.in((Expression) visit(ctx.math_operation()), (String) visit(ctx.name()));
populateQueryContext(expression, ctx);
return expression;
}
Aggregations