use of org.ballerinalang.siddhi.query.api.execution.query.selection.Selector in project ballerina by ballerina-lang.
the class SiddhiQLBaseVisitorImpl method visitQuery_section.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public Selector visitQuery_section(@NotNull SiddhiQLParser.Query_sectionContext ctx) {
// query_section
// :(SELECT ('*'| (output_attribute (',' output_attribute)* ))) group_by? having?
// ;
Selector selector = new Selector();
List<OutputAttribute> attributeList = new ArrayList<OutputAttribute>(ctx.output_attribute().size());
for (SiddhiQLParser.Output_attributeContext output_attributeContext : ctx.output_attribute()) {
attributeList.add((OutputAttribute) visit(output_attributeContext));
}
selector.addSelectionList(attributeList);
if (ctx.group_by() != null) {
selector.addGroupByList((List<Variable>) visit(ctx.group_by()));
}
if (ctx.having() != null) {
selector.having((Expression) visit(ctx.having()));
}
if (ctx.order_by() != null) {
selector.addOrderByList((List<OrderByAttribute>) visit(ctx.order_by()));
}
if (ctx.limit() != null) {
selector.limit((Constant) visit(ctx.limit()));
}
populateQueryContext(selector, ctx);
return selector;
}
use of org.ballerinalang.siddhi.query.api.execution.query.selection.Selector in project ballerina by ballerina-lang.
the class SiddhiQLBaseVisitorImpl method visitStore_query.
@Override
public Object visitStore_query(SiddhiQLParser.Store_queryContext ctx) {
StoreQuery storeQuery = StoreQuery.query().from((InputStore) visit(ctx.store_input()));
if (ctx.query_section() != null) {
storeQuery = storeQuery.select((Selector) visit(ctx.query_section()));
}
populateQueryContext(storeQuery, ctx);
return storeQuery;
}
Aggregations