当前位置: 首页>>代码示例>>Java>>正文


Java SiddhiCompiler.parseStoreQuery方法代码示例

本文整理汇总了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);


}
 
开发者ID:wso2,项目名称:siddhi,代码行数:35,代码来源:QueryStoreTestCase.java

示例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);
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:31,代码来源:QueryStoreTestCase.java

示例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);

}
 
开发者ID:wso2,项目名称:siddhi,代码行数:32,代码来源:QueryStoreTestCase.java

示例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);

}
 
开发者ID:wso2,项目名称:siddhi,代码行数:35,代码来源:QueryStoreTestCase.java


注:本文中的org.wso2.siddhi.query.compiler.SiddhiCompiler.parseStoreQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。