Open sjx782392329 opened 2 weeks ago
I think it's a good idea. Every time I find that the execution plan is not as expected or I encounter optimizer related issues, I need to locate which rule caused this problem, but because there are so many optimization rules, it is difficult to locate which rule caused the plan change. Just like https://github.com/trinodb/trino/issues/23147, it took me a long time to determine which optimization rule caused the problem. Maybe we should make optimization rules easier to debug. @dain @raunaqmorarka @ebyhr cc
When i set
io.trino=DEBUG
in log.properties, I found some logical plan Optimizer can change the logical plan. But I think current debug information makes me confused. I don't know a logical plan handled by some optimizers' rules. I don’t know where the begin and end of an optimizer are. In the IterativeOptimizer rules, only can record which rules change the logical plan. Then I add some extra informationsThen the debug informations like this
Adding this information allows developers to see which rules are executed by each optimizer. It is convenient to check whether your rules are effective when adding new rules.