use of org.apache.calcite.interpreter.JaninoRexCompiler in project spf4j by zolyfarkas.
the class InterpreterUtils method toScalar.
@Nullable
public static Scalar toScalar(final List<RexNode> filters, final RelDataType rowType, final DataContext dataContext) {
if (filters.isEmpty()) {
return null;
} else {
RexBuilder rb = new RexBuilder(dataContext.getTypeFactory());
JaninoRexCompiler compiler = new JaninoRexCompiler(rb);
try {
return compiler.compile(filters, rowType).apply(dataContext);
} catch (UnsupportedOperationException ex) {
LOG.warn("Unable to compile filter: {}", filters, ex);
return null;
}
}
}
Aggregations