Hello, I would say that the default rules are those tested to work well when Calcite is used as an application through the various adapters etc. If you are using Calcite as a library for building a new query planner for another system then you should probably pick the rules from scratch based on the particular needs of your application. Certainly many of those default rules would be useful at some optimization stage.
A bad choice of rules could definitely lead to infinite loops but I would say that this affects more the HepPlanner which applies all the rules till it reaches a fix point. If I remember well the VolcanoPlanner is able to detect that the cost is not improving after a certain number of rule invocations and stop applying useless transformations. Nevertheless, a bad choice of rules could lead to increased optimization time so it should be done with care. Best, Stamatis On Fri, Dec 29, 2023 at 5:08 AM Hongyu Guo <[email protected]> wrote: > > Hi devs, > > I have recently started to learn about planners and rules in Calcite, and > as a beginner, I have some questions. > > > 1. I noticed that RelOptUtil#registerDefault Rules provides default rules. > Can I assume that these rules are the set of rules recommended by Calcite? > What were these rules selected based on? > > > 2. There are some mutually exclusive rules in the default rules, such as > PROJECT_ FILTER_TRANSPOSE and FILTER_PROJECT_TRANSPOSE。Will the presence of > two rules simultaneously result in infinite loops in the planner? > > > Looking forward to the developer's response and discussion! > > > Thank you so much for your time! > > Best regards, > > Hongyu
