Search in sources :

Example 6 with DataContext

use of org.apache.calcite.DataContext in project storm by apache.

the class EvaluationCalc method execute.

@Override
public Iterable<Values> execute(TridentTuple input) {
    Context calciteContext = new StormContext(dataContext);
    calciteContext.values = input.getValues().toArray();
    if (filterInstance != null) {
        filterInstance.execute(calciteContext, outputValues);
        // filtered out
        if (outputValues[0] == null || !((Boolean) outputValues[0])) {
            return Collections.emptyList();
        }
    }
    if (projectionInstance != null) {
        projectionInstance.execute(calciteContext, outputValues);
        return Collections.singletonList(new Values(outputValues));
    } else {
        return Collections.singletonList(new Values(input.getValues()));
    }
}
Also used : DataContext(org.apache.calcite.DataContext) TridentOperationContext(org.apache.storm.trident.operation.TridentOperationContext) StormContext(org.apache.calcite.interpreter.StormContext) Context(org.apache.calcite.interpreter.Context) Values(org.apache.storm.tuple.Values) StormContext(org.apache.calcite.interpreter.StormContext)

Aggregations

DataContext (org.apache.calcite.DataContext)6 Context (org.apache.calcite.interpreter.Context)3 StormContext (org.apache.calcite.interpreter.StormContext)3 TridentOperationContext (org.apache.storm.trident.operation.TridentOperationContext)3 Values (org.apache.storm.tuple.Values)3 RexBuilder (org.apache.calcite.rex.RexBuilder)2 AbstractTridentProcessor (org.apache.storm.sql.AbstractTridentProcessor)2 TridentTopology (org.apache.storm.trident.TridentTopology)2 Supplier (com.google.common.base.Supplier)1 Sequence (io.druid.java.util.common.guava.Sequence)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 BindableRel (org.apache.calcite.interpreter.BindableRel)1 Bindables (org.apache.calcite.interpreter.Bindables)1 Enumerable (org.apache.calcite.linq4j.Enumerable)1 RexNode (org.apache.calcite.rex.RexNode)1 TestUtils (org.apache.storm.sql.TestUtils)1 MockState.getCollectedValues (org.apache.storm.sql.TestUtils.MockState.getCollectedValues)1 CompilingClassLoader (org.apache.storm.sql.javac.CompilingClassLoader)1 QueryPlanner (org.apache.storm.sql.planner.trident.QueryPlanner)1