[ https://issues.apache.org/jira/browse/CALCITE-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16934134#comment-16934134 ]
Danny Chan commented on CALCITE-3353: ------------------------------------- Thanks [~zabetak], i kind of disagree with your point for 2 reasons: # The default instance name was changed which would break the compatibility # There are many instances in one rule which just different with node types or conventions which i think would make user confused (except that he is very familiar with Calcite rule planning) I'm considering if we can # accurately give out a rule list that don't really need to match the convention nodes, and change them always match logical nodes # or if we can figure out a way to parameterized these variables(node types, the conventions etc.) I kind of suggest RelFactory to be the only entrance to construct new nodes during planning, it should support the convention copy and we deprecate the RelNode#copy method. > ProjectJoinTransposeRule caused AssertionError when creating a new Join > ----------------------------------------------------------------------- > > Key: CALCITE-3353 > URL: https://issues.apache.org/jira/browse/CALCITE-3353 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.20.0 > Reporter: TANG Wen-hui > Assignee: TANG Wen-hui > Priority: Major > Labels: pull-request-available > Time Spent: 1h 50m > Remaining Estimate: 0h > > Trying to add ProjectJoinTransposeRule to the rule set to optimize sql (using > VolcanoPlanner). > Get the following exception: > Caused by: java.lang.AssertionErrorCaused by: java.lang.AssertionError at > org.apache.calcite.adapter.enumerable.EnumerableMergeJoin.<init>(EnumerableMergeJoin.java:72) > at > org.apache.calcite.adapter.enumerable.EnumerableMergeJoin.copy(EnumerableMergeJoin.java:112) > at > org.apache.calcite.adapter.enumerable.EnumerableMergeJoin.copy(EnumerableMergeJoin.java:59) > at > org.apache.calcite.rel.rules.ProjectJoinTransposeRule.onMatch(ProjectJoinTransposeRule.java:155) > at > org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208) > at > org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:703) > at org.apache.calcite.tools.Programs.lambda$standard$7(Programs.java:466) at > org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:528) at > org.apache.calcite.prepare.Prepare.optimize(Prepare.java:196) at > org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:416) at > org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:310) at > org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:830) > at > org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:610) > at > org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:580) > at > org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:247) > at > org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:711) > > ... 22 more > This is because the ProjectJoinTransposeRule can match multiple types of Join > and ProjectJoinTransposeRule creates a new Join using the join.copy() method. > When the rule applied to EnumerableMergeJoin, and the new Join created by > this rule may not meet the requirements of EnumerableMergeJoin. > {code:java} > EnumerableMergeJoin( > RelOptCluster cluster, > RelTraitSet traits, > RelNode left, > RelNode right, > RexNode condition, > Set<CorrelationId> variablesSet, > JoinRelType joinType) { > super(cluster, traits, left, right, condition, variablesSet, joinType); > final List<RelCollation> collations = > traits.getTraits(RelCollationTraitDef.INSTANCE); > assert collations == null || RelCollations.contains(collations, > joinInfo.leftKeys); > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)