Search in sources :

Example 26 with ChannelHandler

use of org.apache.storm.sql.runtime.ChannelHandler in project storm by apache.

the class TestExprSemantic method testExpr.

private Values testExpr(List<String> exprs) throws Exception {
    String sql = "SELECT " + Joiner.on(',').join(exprs) + " FROM FOO" + " WHERE ID > 0 AND ID < 2";
    TestCompilerUtils.CalciteState state = TestCompilerUtils.sqlOverDummyTable(sql);
    PlanCompiler compiler = new PlanCompiler(typeFactory);
    AbstractValuesProcessor proc = compiler.compile(state.tree());
    Map<String, DataSource> data = new HashMap<>();
    data.put("FOO", new TestUtils.MockDataSource());
    List<Values> values = new ArrayList<>();
    ChannelHandler h = new TestUtils.CollectDataChannelHandler(values);
    proc.initialize(data, h);
    return values.get(0);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Values(org.apache.storm.tuple.Values) AbstractValuesProcessor(org.apache.storm.sql.runtime.AbstractValuesProcessor) ChannelHandler(org.apache.storm.sql.runtime.ChannelHandler) DataSource(org.apache.storm.sql.runtime.DataSource) PlanCompiler(org.apache.storm.sql.compiler.backends.standalone.PlanCompiler) TestUtils(org.apache.storm.sql.TestUtils) TestCompilerUtils(org.apache.storm.sql.compiler.backends.standalone.TestCompilerUtils)

Aggregations

ArrayList (java.util.ArrayList)26 ChannelHandler (org.apache.storm.sql.runtime.ChannelHandler)26 Values (org.apache.storm.tuple.Values)26 Test (org.junit.Test)25 HashMap (java.util.HashMap)5 TestUtils (org.apache.storm.sql.TestUtils)5 AbstractValuesProcessor (org.apache.storm.sql.runtime.AbstractValuesProcessor)5 DataSource (org.apache.storm.sql.runtime.DataSource)5 ImmutableMap (com.google.common.collect.ImmutableMap)2 Map (java.util.Map)2 PlanCompiler (org.apache.storm.sql.compiler.backends.standalone.PlanCompiler)1 TestCompilerUtils (org.apache.storm.sql.compiler.backends.standalone.TestCompilerUtils)1