Search in sources :

Example 1 with EvaluationFunction

use of org.apache.storm.sql.runtime.streams.functions.EvaluationFunction 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

RelNode (org.apache.calcite.rel.RelNode)1 RelDataType (org.apache.calcite.rel.type.RelDataType)1 RexNode (org.apache.calcite.rex.RexNode)1 ExecutableExpression (org.apache.storm.sql.runtime.calcite.ExecutableExpression)1 EvaluationFunction (org.apache.storm.sql.runtime.streams.functions.EvaluationFunction)1 Values (org.apache.storm.tuple.Values)1