[ https://issues.apache.org/jira/browse/CALCITE-1503?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15690692#comment-15690692 ]
Julian Hyde commented on CALCITE-1503: -------------------------------------- The attachment is the planner trace log; here is jstack: {noformat} "main" #1 prio=5 os_prio=31 tid=0x00007fe6bd005000 nid=0x1403 runnable [0x0000700001c1a000] java.lang.Thread.State: RUNNABLE at org.apache.calcite.plan.volcano.RuleQueue.popMatch(RuleQueue.java:479) at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:797) at org.apache.calcite.tools.Programs$5.run(Programs.java:300) at org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:351) at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:155) at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:286) at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:195) at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:740) at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:603) at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:573) at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:215) at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:594) - locked <0x0000000772145ea0> (a org.apache.calcite.jdbc.CalciteJdbc41Factory$CalciteJdbc41Statement) at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:615) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149) at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218) {noformat} The volcano planner is firing rules, and the rule match queue is getting longer and longer. I think this is typical of what happens when you use volcano and exhaustive join rewrite for join order optimization. > Infinite loop occurs during query planning > ------------------------------------------ > > Key: CALCITE-1503 > URL: https://issues.apache.org/jira/browse/CALCITE-1503 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.10.0 > Reporter: Miguel Oliveira > Assignee: Julian Hyde > Attachments: output > > > The following query: > {code} > SELECT count(*) FROM ( > SELECT count(v1.`region_id`) `Count Region`, v6.`fullname` > `Customer (Name)` > FROM `foodmart`.`region` v1 > JOIN `foodmart`.`store` v3 ON v1.`region_id` = v3.`region_id` > JOIN `foodmart`.`customer` v6 ON v1.`region_id` = > v6.`customer_region_id` > JOIN `foodmart`.`sales_fact_1998` v15 ON v3.`store_id` = > v15.`store_id` AND v6.`customer_id` = v15.`customer_id` > WHERE v3.`store_name` LIKE '%Grocery%' > GROUP BY v6.`customer_region_id`,v6.`fullname`) a > {code} > causes an infinite loop during query plan. -- This message was sent by Atlassian JIRA (v6.3.4#6332)