Hello Pranav, here some untested pseudo-code that could give you an idea how to achieve this. It probably needs several adaptations to make it work (marked with "<- here", possibly others).
private static final Method BIND = Types.lookupMethod(Bindable.class, > "bind", Bindable.class, DataContext.class); // <- here > > private static class EnumerableBindableRel extends AbstractRelNode > implements EnumerableRel { > private final BindableRel bindable; > > public EnumerableBindableRel(BindableRel bindable) { > super(bindable.getCluster(), bindable.getTraitSet()); > this.bindable = bindable; > } > > @Override > public Result implement(EnumerableRelImplementor implementor, Prefer > pref) { > final PhysType physType = PhysTypeImpl.of( > implementor.getTypeFactory(), > this.getRowType(), > JavaRowFormat.ARRAY); // <- here > > final BlockBuilder builder = new BlockBuilder(); > MethodCallExpression call = Expressions.call( // <- here, correct > arguments? > implementor.stash(this.bindable, Bindable.class), > BIND, > implementor.getRootExpression()); > > ParameterExpression resultVar = > Expressions.parameter(Enumerable.class, "_result"); > builder.add(Expressions.declare(Modifier.FINAL, resultVar, call)); > builder.add(Expressions.return_(null, resultVar)); > return implementor.result(physType, builder.toBlock()); > } > } > > private static EnumerableRel getEnumerableRel(BindableRel bindable) { > return new EnumerableBindableRel(bindable); > } > Cordialement / Best Regards, Dr. Thomas Rebele | R&D Developer | Germany | E treb...@tibco.com | W www.tibco.com TIBCO Software GmbH | St.-Martin-Str. 106, 81669 München, Deutschland | Registergericht: Amtsgericht München, HRB 123355 | Geschäftsführer: William Hughes; Alexander E. Kolar Cordialement / Best Regards, *Dr. Thomas Rebele* | R&D Developer | Germany | *E* *treb...@tibco.com <treb...@tibco.com>* | *W* *www.tibco.com <http://www.tibco.com/>* *TIBCO Software GmbH* | St.-Martin-Str. 106, 81669 München, Deutschland | Registergericht: Amtsgericht München, HRB 123355 | Geschäftsführer: William Hughes; Alexander E. Kolar On Fri, Sep 23, 2022 at 10:50 PM Pranav Deshpande < deshpande.v.pra...@gmail.com> wrote: > Dear Apache Calcite Team, > Is there a way to convert a BindableRel into an EnumerableRel? > > There is a rule to convert an EnumerableRel into a BindableRel, but not the > other way around. > > I am asking this because I wish to have my TableScans use the > BindableConvention and the rest of my execution using the Enumerable > Convention [as it has more operators!]. > > Regards, > Pranav >