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);
}
Aggregations