[ 
https://issues.apache.org/jira/browse/CALCITE-3505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jin Xing updated CALCITE-3505:
------------------------------
    Description: 
Run ScannableTableTest#testProjectableFilterableTableJoin with minor change to 
reproduce
{code:java}
@Test public void testProjectableFilterableTableJoin() throws Exception {
  final StringBuilder buf = new StringBuilder();
  final String explain = "PLAN="
      + "EnumerableHashJoin(condition=[=($0, $3)], joinType=[inner])\n"
      + "  EnumerableInterpreter\n"
      + "    BindableTableScan(table=[[s, b1]], filters=[[=($0, 10)]])\n"
      + "  EnumerableInterpreter\n"
      + "    BindableTableScan(table=[[s, b2]], filters=[[=($0, 10)]])";
  CalciteAssert.that()
          .with(
            newSchema("s",
                Pair.of("b1", new BeatlesProjectableFilterableTable(buf, true)),
                Pair.of("b2", new BeatlesProjectableFilterableTable(buf, 
true))))
          .query("select * from \"s\".\"b1\", \"s\".\"b2\" "
                  + "where \"s\".\"b1\".\"i\" = 10 and \"s\".\"b2\".\"i\" = 10 "
                  + "and \"s\".\"b1\".\"i\" = \"s\".\"b2\".\"i\"")
          .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> {
            planner.removeRule(EnumerableRules.ENUMERABLE_MERGE_JOIN_RULE);
          })
      .explainContains(explain);
}
{code}
This test has nothing to do with ENUMERABLE_MERGE_JOIN_RULE, but if we disable 
it with planner hook, stackoverflow happens;

I debugged and found that FilterProjectTransposeRule is matched infinitely but 
not sure the root cause.

 

 

  was:
Run ScannableTableTest#testProjectableFilterableTableJoin with minor change to 
reproduce
{code:java}
@Test public void testProjectableFilterableTableJoin() throws Exception {
  final StringBuilder buf = new StringBuilder();
  final String explain = "PLAN="
      + "EnumerableHashJoin(condition=[=($0, $3)], joinType=[inner])\n"
      + "  EnumerableInterpreter\n"
      + "    BindableTableScan(table=[[s, b1]], filters=[[=($0, 10)]])\n"
      + "  EnumerableInterpreter\n"
      + "    BindableTableScan(table=[[s, b2]], filters=[[=($0, 10)]])";
  CalciteAssert.that()
          .with(
            newSchema("s",
                Pair.of("b1", new BeatlesProjectableFilterableTable(buf, true)),
                Pair.of("b2", new BeatlesProjectableFilterableTable(buf, 
true))))
          .query("select * from \"s\".\"b1\", \"s\".\"b2\" "
                  + "where \"s\".\"b1\".\"i\" = 10 and \"s\".\"b2\".\"i\" = 10 "
                  + "and \"s\".\"b1\".\"i\" = \"s\".\"b2\".\"i\"")
          .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> {
            planner.removeRule(EnumerableRules.ENUMERABLE_MERGE_JOIN_RULE);
          })
      .explainContains(explain);
}
{code}
This test has nothing to do with ENUMERABLE_MERGE_JOIN_RULE, but if we disable 
it with planner hook, stackoverflow happens;

I debugged and found that FilterProjectTransposeRule is matched infinitely and 
I found input-cycle of two RelSubset of EnumerableConvention from graphviz.

 

 


> Infinite matching of FilterProjectTransposeRule causes stackoverflow
> --------------------------------------------------------------------
>
>                 Key: CALCITE-3505
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3505
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jin Xing
>            Priority: Major
>
> Run ScannableTableTest#testProjectableFilterableTableJoin with minor change 
> to reproduce
> {code:java}
> @Test public void testProjectableFilterableTableJoin() throws Exception {
>   final StringBuilder buf = new StringBuilder();
>   final String explain = "PLAN="
>       + "EnumerableHashJoin(condition=[=($0, $3)], joinType=[inner])\n"
>       + "  EnumerableInterpreter\n"
>       + "    BindableTableScan(table=[[s, b1]], filters=[[=($0, 10)]])\n"
>       + "  EnumerableInterpreter\n"
>       + "    BindableTableScan(table=[[s, b2]], filters=[[=($0, 10)]])";
>   CalciteAssert.that()
>           .with(
>             newSchema("s",
>                 Pair.of("b1", new BeatlesProjectableFilterableTable(buf, 
> true)),
>                 Pair.of("b2", new BeatlesProjectableFilterableTable(buf, 
> true))))
>           .query("select * from \"s\".\"b1\", \"s\".\"b2\" "
>                   + "where \"s\".\"b1\".\"i\" = 10 and \"s\".\"b2\".\"i\" = 
> 10 "
>                   + "and \"s\".\"b1\".\"i\" = \"s\".\"b2\".\"i\"")
>           .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> {
>             planner.removeRule(EnumerableRules.ENUMERABLE_MERGE_JOIN_RULE);
>           })
>       .explainContains(explain);
> }
> {code}
> This test has nothing to do with ENUMERABLE_MERGE_JOIN_RULE, but if we 
> disable it with planner hook, stackoverflow happens;
> I debugged and found that FilterProjectTransposeRule is matched infinitely 
> but not sure the root cause.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to