use of org.apache.calcite.interpreter.StormContext in project storm by apache.
the class EvaluationFilter method isKeep.
@Override
public boolean isKeep(TridentTuple tuple) {
Context calciteContext = new StormContext(dataContext);
calciteContext.values = tuple.getValues().toArray();
filterInstance.execute(calciteContext, outputValues);
return (outputValues[0] != null && (boolean) outputValues[0]);
}
use of org.apache.calcite.interpreter.StormContext in project storm by apache.
the class EvaluationFunction method execute.
@Override
public Values execute(TridentTuple input) {
Context calciteContext = new StormContext(dataContext);
calciteContext.values = input.getValues().toArray();
projectionInstance.execute(calciteContext, outputValues);
return new Values(outputValues);
}
use of org.apache.calcite.interpreter.StormContext 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()));
}
}
Aggregations