Hi Marieke,

Usually for a fledged SQL engine built on top of Calcite, it uses both
planner.
And we have Program[1] abstraction to organize multi stages to plan a query.
You can take a look at Calcite's default implementation here[2].

[1]
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/tools/Program.java
[2]
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/prepare/Prepare.java#L176

Marieke Gueye <[email protected]> 于2022年4月23日周六 04:50写道:

> Hey everybody,
>
> I created an adapter with some rules pushing down everything (Projects,
> Filter,..)  to a single Rel, let's call it CustomRel:
>
> So for example my Project Rule basically transforms:
> LogicalProject(R_NAME=[$0])
>   CustomRel(projects=[[$0, $1]])
> to
>   CustomRel(projects=[[$0]])
>
> I also have a CustomRelToEnumerableConverter &
> CustomRelToEnumerableConverterRule that converts the trait set from my
> custom convention (in the CustomRel) to an Enumerable.
>
> I am using Avatica with my adapter and realised that the Volcano planner is
> not working as I would expect it to. Instead of first pushing down
> everything to CustomRel then converting to enumerable, it is pushing down
> only one rel above it, applying the convert and then doing some
> EnumerableCalc.. Changing the selfCost of CustomRel did not help.
>
> I also tried overriding the planner (overriding createPlanner from
> CalcitePrepareImpl) so it uses a HepPlanner but it looks like the planner
> loses the trait information and the converter is never fired.
>
> Any idea what would be the solution in this case?
>
> Thanks for your help
>


-- 

Best,
Benchao Li

Reply via email to