Description
Infinite loop is obtained while using FilterIntoJoinRule + JoinPushTransitivePredicatesRule in HEP planner for some correlated queries, for instance:
select d.deptno from sales.emp d where d.deptno IN (select e.deptno from sales.emp e where e.deptno = d.deptno or e.deptno = 4)
@Test public void testJoinPushTransitivePredicatesRule() { HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN) .addRuleInstance(FilterJoinRule.JOIN) .addRuleInstance(JoinPushTransitivePredicatesRule.INSTANCE) .build(); HepProgramBuilder builder = new HepProgramBuilder(); HepPlanner hepPlanner = new HepPlanner(builder.build()); final String sql = "select d.deptno from sales.emp d where d.deptno\n" + "IN (select e.deptno from sales.emp e " + "where e.deptno = d.deptno or e.deptno = 4)"; TesterImpl tester = new TesterImpl(getDiffRepos(), true, false, true, false, null, null); checkPlanning(tester, preProgram, hepPlanner, sql); }
java.lang.StackOverflowError at org.apache.calcite.util.mapping.Mappings$PartialFunctionImpl.<init>(Mappings.java:1568) at org.apache.calcite.util.mapping.Mappings.create(Mappings.java:76) at org.apache.calcite.rel.metadata.RelMdPredicates.getPredicates(RelMdPredicates.java:185) at GeneratedMetadataHandler_Predicates.getPredicates_$(Unknown Source) at GeneratedMetadataHandler_Predicates.getPredicates(Unknown Source) at GeneratedMetadataHandler_Predicates.getPredicates_$(Unknown Source) at GeneratedMetadataHandler_Predicates.getPredicates(Unknown Source) at org.apache.calcite.rel.metadata.RelMetadataQuery.getPulledUpPredicates(RelMetadataQuery.java:802) at org.apache.calcite.rel.metadata.RelMdPredicates.getPredicates(RelMdPredicates.java:344) at GeneratedMetadataHandler_Predicates.getPredicates_$(Unknown Source) at GeneratedMetadataHandler_Predicates.getPredicates(Unknown Source) at GeneratedMetadataHandler_Predicates.getPredicates_$(Unknown Source) at GeneratedMetadataHandler_Predicates.getPredicates(Unknown Source) at org.apache.calcite.rel.metadata.RelMetadataQuery.getPulledUpPredicates(RelMetadataQuery.java:802) at org.apache.calcite.rel.metadata.RelMdPredicates.getPredicates(RelMdPredicates.java:318) at GeneratedMetadataHandler_Predicates.getPredicates_$(Unknown Source) ...
Note1: for the same query, but with AND operator the rule works fine.
Note2: the rile works also after firing JoinToCorrelateRule rule.
Attachments
Issue Links
- blocks
-
DRILL-6173 Support transitive closure during filter push down and partition pruning
- Resolved
- is related to
-
CALCITE-2205 JoinPushTransitivePredicatesRule should not create a Filter on top of an equivalent Filter
- Closed