Search in sources :

Example 6 with AggregationDefinition

use of org.ballerinalang.siddhi.query.api.definition.AggregationDefinition in project ballerina by ballerina-lang.

the class SiddhiCompiler method parseAggregationDefinition.

public static AggregationDefinition parseAggregationDefinition(String source) throws SiddhiParserException {
    ANTLRInputStream input = new ANTLRInputStream(source);
    SiddhiQLLexer lexer = new SiddhiQLLexer(input);
    lexer.removeErrorListeners();
    lexer.addErrorListener(SiddhiErrorListener.INSTANCE);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    SiddhiQLParser parser = new SiddhiQLParser(tokens);
    parser.removeErrorListeners();
    parser.addErrorListener(SiddhiErrorListener.INSTANCE);
    ParseTree tree = parser.definition_aggregation_final();
    SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
    return (AggregationDefinition) eval.visit(tree);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) AggregationDefinition(org.ballerinalang.siddhi.query.api.definition.AggregationDefinition) SiddhiQLBaseVisitorImpl(org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Aggregations

AggregationDefinition (org.ballerinalang.siddhi.query.api.definition.AggregationDefinition)6 StreamDefinition (org.ballerinalang.siddhi.query.api.definition.StreamDefinition)2 TableDefinition (org.ballerinalang.siddhi.query.api.definition.TableDefinition)2 WindowDefinition (org.ballerinalang.siddhi.query.api.definition.WindowDefinition)2 DuplicateDefinitionException (org.ballerinalang.siddhi.query.api.exception.DuplicateDefinitionException)2 Test (org.testng.annotations.Test)2 ANTLRInputStream (org.antlr.v4.runtime.ANTLRInputStream)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1 ParseTree (org.antlr.v4.runtime.tree.ParseTree)1 TimePeriod (org.ballerinalang.siddhi.query.api.aggregation.TimePeriod)1 AbstractDefinition (org.ballerinalang.siddhi.query.api.definition.AbstractDefinition)1 BasicSingleInputStream (org.ballerinalang.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream)1 BasicSelector (org.ballerinalang.siddhi.query.api.execution.query.selection.BasicSelector)1 Variable (org.ballerinalang.siddhi.query.api.expression.Variable)1 SiddhiQLParser (org.ballerinalang.siddhi.query.compiler.SiddhiQLParser)1 SiddhiQLBaseVisitorImpl (org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl)1