Search in sources :

Example 11 with ExecutableExpression

use of org.apache.storm.sql.runtime.calcite.ExecutableExpression in project storm by apache.

the class StreamsProjectRel method streamsPlan.

@Override
public void streamsPlan(StreamsPlanCreator planCreator) throws Exception {
    // SingleRel
    RelNode input = getInput();
    StormRelUtils.getStormRelInput(input).streamsPlan(planCreator);
    Stream<Values> inputStream = planCreator.pop();
    String projectionClassName = StormRelUtils.getClassName(this);
    List<String> outputFieldNames = getRowType().getFieldNames();
    int outputCount = outputFieldNames.size();
    List<RexNode> childExps = getChildExps();
    RelDataType inputRowType = getInput(0).getRowType();
    ExecutableExpression projectionInstance = planCreator.createScalarInstance(childExps, inputRowType, projectionClassName);
    EvaluationFunction evalFunc = new EvaluationFunction(projectionInstance, outputCount, planCreator.getDataContext());
    final Stream<Values> finalStream = inputStream.map(evalFunc);
    planCreator.addStream(finalStream);
}
Also used : RelNode(org.apache.calcite.rel.RelNode) Values(org.apache.storm.tuple.Values) EvaluationFunction(org.apache.storm.sql.runtime.streams.functions.EvaluationFunction) RelDataType(org.apache.calcite.rel.type.RelDataType) RexNode(org.apache.calcite.rex.RexNode) ExecutableExpression(org.apache.storm.sql.runtime.calcite.ExecutableExpression)

Aggregations

ExecutableExpression (org.apache.storm.sql.runtime.calcite.ExecutableExpression)11 RelNode (org.apache.calcite.rel.RelNode)6 RelDataType (org.apache.calcite.rel.type.RelDataType)6 RexNode (org.apache.calcite.rex.RexNode)6 CompilingClassLoader (org.apache.storm.sql.javac.CompilingClassLoader)4 DebuggableExecutableExpression (org.apache.storm.sql.runtime.calcite.DebuggableExecutableExpression)4 Stream (org.apache.storm.trident.Stream)3 Values (org.apache.storm.tuple.Values)3 ArrayList (java.util.ArrayList)2 RexLocalRef (org.apache.calcite.rex.RexLocalRef)2 Fields (org.apache.storm.tuple.Fields)2 BlockBuilder (org.apache.calcite.linq4j.tree.BlockBuilder)1 ClassDeclaration (org.apache.calcite.linq4j.tree.ClassDeclaration)1 Expression (org.apache.calcite.linq4j.tree.Expression)1 MemberDeclaration (org.apache.calcite.linq4j.tree.MemberDeclaration)1 ParameterExpression (org.apache.calcite.linq4j.tree.ParameterExpression)1 EvaluationCalc (org.apache.storm.sql.runtime.streams.functions.EvaluationCalc)1 EvaluationFilter (org.apache.storm.sql.runtime.streams.functions.EvaluationFilter)1 EvaluationFunction (org.apache.storm.sql.runtime.streams.functions.EvaluationFunction)1 EvaluationCalc (org.apache.storm.sql.runtime.trident.functions.EvaluationCalc)1