本文整理汇总了Java中org.wso2.siddhi.query.compiler.SiddhiCompiler.parseStoreQuery方法的典型用法代码示例。如果您正苦于以下问题:Java SiddhiCompiler.parseStoreQuery方法的具体用法?Java SiddhiCompiler.parseStoreQuery怎么用?Java SiddhiCompiler.parseStoreQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.siddhi.query.compiler.SiddhiCompiler
的用法示例。
在下文中一共展示了SiddhiCompiler.parseStoreQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test1
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void test1() throws SiddhiParserException {
StoreQuery query = SiddhiCompiler.parseStoreQuery("" +
"from StockTable " +
"on price>3 " +
"select symbol, avg(price) as avgPrice " +
"group by symbol " +
"having (price >= 20) ;"
);
AssertJUnit.assertNotNull(query);
StoreQuery api = StoreQuery.query().
from(
InputStore.store("StockTable").
on(Expression.compare(Expression.variable("price"),
Compare.Operator.GREATER_THAN,
Expression.value(3)))).
select(
Selector.selector().
select(Expression.variable("symbol")).
select("avgPrice", Expression.function("avg", Expression.variable("price"))).
groupBy(Expression.variable("symbol")).
having(
Expression.compare(
Expression.variable("price"),
Compare.Operator.GREATER_THAN_EQUAL,
Expression.value(20))
)
);
AssertJUnit.assertEquals(api, query);
}
示例2: test2
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void test2() {
StoreQuery query = SiddhiCompiler.parseStoreQuery("" +
"from StockTable " +
"select symbol, price " +
"group by symbol " +
"having (7 > price) ;"
);
AssertJUnit.assertNotNull(query);
StoreQuery api = StoreQuery.query().
from(
InputStore.store("StockTable")).
select(
Selector.selector().
select("symbol", Expression.variable("symbol")).
select(Expression.variable("price")).
groupBy(Expression.variable("symbol")).
having(
Expression.compare(
Expression.value(7),
Compare.Operator.GREATER_THAN,
Expression.variable("price"))
)
);
AssertJUnit.assertEquals(api, query);
}
示例3: test3
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void test3() {
StoreQuery query = SiddhiCompiler.parseStoreQuery("" +
"from StockTable " +
"on price > 40 " +
"select symbol, price " +
"group by symbol " +
"having (7 > price) ;"
);
AssertJUnit.assertNotNull(query);
StoreQuery api = StoreQuery.query().
from(
InputStore.store("StockTable").
on(Expression.compare(Expression.variable("price"),
Compare.Operator.GREATER_THAN, Expression.value(40)))).
select(
Selector.selector().
select("symbol", Expression.variable("symbol")).
select(Expression.variable("price")).
groupBy(Expression.variable("symbol")).
having(
Expression.compare(
Expression.value(7),
Compare.Operator.GREATER_THAN,
Expression.variable("price"))
)
);
AssertJUnit.assertEquals(api, query);
}
示例4: test4
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void test4() {
StoreQuery query = SiddhiCompiler.parseStoreQuery("" +
"from StockTable " +
"on price > 40 " +
"within '2017/01/*' " +
"per 'day' " +
"select symbol, price " +
"group by symbol " +
"having (7 > price) ;"
);
AssertJUnit.assertNotNull(query);
StoreQuery api = StoreQuery.query().
from(
InputStore.store("StockTable").
on(Expression.compare(Expression.variable("price"),
Compare.Operator.GREATER_THAN, Expression.value(40)),
Within.within(Expression.value("2017/01/*")), Expression.value("day"))).
select(
Selector.selector().
select("symbol", Expression.variable("symbol")).
select(Expression.variable("price")).
groupBy(Expression.variable("symbol")).
having(
Expression.compare(
Expression.value(7),
Compare.Operator.GREATER_THAN,
Expression.variable("price"))
)
);
AssertJUnit.assertEquals(api, query);
}