use of org.apache.calcite.runtime.Bindable in project calcite by apache.
the class EnumerableInterpretable method getBindable.
static Bindable getBindable(ClassDeclaration expr, String s, int fieldCount) throws CompileException, IOException {
ICompilerFactory compilerFactory;
try {
compilerFactory = CompilerFactoryFactory.getDefaultCompilerFactory();
} catch (Exception e) {
throw new IllegalStateException("Unable to instantiate java compiler", e);
}
IClassBodyEvaluator cbe = compilerFactory.newClassBodyEvaluator();
cbe.setClassName(expr.name);
cbe.setExtendedClass(Utilities.class);
cbe.setImplementedInterfaces(fieldCount == 1 ? new Class[] { Bindable.class, Typed.class } : new Class[] { ArrayBindable.class });
cbe.setParentClassLoader(EnumerableInterpretable.class.getClassLoader());
if (CalcitePrepareImpl.DEBUG) {
// Add line numbers to the generated janino class
cbe.setDebuggingInformation(true, true, true);
}
return (Bindable) cbe.createInstance(new StringReader(s));
}
use of org.apache.calcite.runtime.Bindable in project calcite by apache.
the class EnumerableBindable method bind.
public Enumerable<Object[]> bind(DataContext dataContext) {
final ImmutableMap<String, Object> map = ImmutableMap.of();
final Bindable bindable = EnumerableInterpretable.toBindable(map, null, (EnumerableRel) getInput(), EnumerableRel.Prefer.ARRAY);
final ArrayBindable arrayBindable = EnumerableInterpretable.box(bindable);
return arrayBindable.bind(dataContext);
}
use of org.apache.calcite.runtime.Bindable in project calcite by apache.
the class EnumerableInterpretable method implement.
public Node implement(final InterpreterImplementor implementor) {
final Bindable bindable = toBindable(implementor.internalParameters, implementor.spark, (EnumerableRel) getInput(), EnumerableRel.Prefer.ARRAY);
final ArrayBindable arrayBindable = box(bindable);
final Enumerable<Object[]> enumerable = arrayBindable.bind(implementor.dataContext);
return new EnumerableNode(enumerable, implementor.compiler, this);
}
Aggregations