use of org.apache.storm.sql.runtime.trident.functions.EvaluationFunction in project storm by apache.
the class TridentProjectRel method tridentPlan.
@Override
public void tridentPlan(TridentPlanCreator planCreator) throws Exception {
// SingleRel
RelNode input = getInput();
StormRelUtils.getStormRelInput(input).tridentPlan(planCreator);
Stream inputStream = planCreator.pop().toStream();
String stageName = StormRelUtils.getStageName(this);
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);
Stream finalStream = inputStream.map(new EvaluationFunction(projectionInstance, outputCount, planCreator.getDataContext()), new Fields(outputFieldNames)).name(stageName);
planCreator.addStream(finalStream);
}
Aggregations