You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Jesus Camacho Rodriguez (JIRA)" <ji...@apache.org> on 2019/03/01 00:45:00 UTC
[jira] [Created] (CALCITE-2883) HepPlanner subprogram may loop till
getting out of memory
Jesus Camacho Rodriguez created CALCITE-2883:
------------------------------------------------
Summary: HepPlanner subprogram may loop till getting out of memory
Key: CALCITE-2883
URL: https://issues.apache.org/jira/browse/CALCITE-2883
Project: Calcite
Issue Type: Bug
Reporter: Jesus Camacho Rodriguez
Assignee: Jesus Camacho Rodriguez
Consider the following two hep programs.
Program 1:
{code}
final HepProgramBuilder programBuilder = new HepProgramBuilder();
programBuilder.addMatchOrder(HepMatchOrder.BOTTOM_UP);
programBuilder.addRuleInstance(JoinToMultiJoinRule.INSTANCE);
programBuilder.addRuleInstance(LoptOptimizeJoinRule.INSTANCE);
final HepProgram program = programBuilder.build();
{code}
Program 2:
{code}
final HepProgramBuilder programBuilder = new HepProgramBuilder();
final HepProgramBuilder subprogramBuilder = new HepProgramBuilder();
subprogramBuilder.addMatchOrder(HepMatchOrder.BOTTOM_UP);
subprogramBuilder.addRuleInstance(JoinToMultiJoinRule.INSTANCE);
subprogramBuilder.addRuleInstance(LoptOptimizeJoinRule.INSTANCE);
programBuilder.addSubprogram(subprogramBuilder.build());
final HepProgram program = programBuilder.build();
{code}
I would expect both programs to behave similarly. However, program 2 will loop indefinitely. The reason is that {{HepPlanner}} subprogram execution loops if subprogram generates any new expression.
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/hep/HepPlanner.java#L339
This does not seem right since planner can control exiting the program (and thus, subprogram) depending on its own internal state and configuration properties, e.g., match limit.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)