I think you can start from org.apache.calcite.tools#Program.java, and check its 
implementation classes, you will find some example code constructing Planner 
and adding rules. And you can also checkout some open-source project which uses 
calcite as their optimizer, like Apache Flink and Apache Hive, you can search 
for Program implementations in their codebase and see how they construct 
planner and adding rules. 

> Hey everyone,
> 
> 
> I'm new to Apache Calcite and trying to get my head around building a query 
> optimizer.
> 
> 
> So far, I've managed to parse a set of SQL queries and convert them into 
> RelNodes. My understanding is that the next step is often to use a HepPlanner 
> followed by a VolcanoPlanner. (Is that generally the right approach?)
> 
> 
> My main question is about the HepPlanner. It uses rules, and looking through 
> CoreRules, there are so many! They all seem potentially useful in different 
> scenarios. How do people typically decide which rules to apply with 
> HepPlanner? Do I need to manually figure out the best rules based on the 
> patterns in my specific SQLs, or is there a more standard set or strategy?
> 
> 
> Any pointers would be awesome!
> 
> 
> Thanks,
> 
>  Liu Yi
> 

Reply via email to