[ 
https://issues.apache.org/jira/browse/CALCITE-7237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18031266#comment-18031266
 ] 

Ian Bertolacci commented on CALCITE-7237:
-----------------------------------------

We failed the assertion this with the following:
{code:java}
ImmutableOurSpecialTopSecretRule.Config.builder().build()
  .withOperandSupplier(root -> 
    root.operand(Join.class)
        .predicate(join -> ...)
        .unorderedInputs(
          operand1 -> operand1.operand(RelNode.class).predicate(node -> 
...).anyInputs(),
          operand2 -> operand1.operand(Aggregate.class).predicate(aggr -> 
...).anyInputs()
        )
  )
{code}
And the trace was:
{code:java}
Caused by: java.lang.AssertionError
        at 
org.apache.calcite.plan.RelOptRuleOperand.<init>(RelOptRuleOperand.java:121)
        at 
org.apache.calcite.plan.RelRule$OperandDetailBuilderImpl.done(RelRule.java:287)
        at 
org.apache.calcite.plan.RelRule$OperandDetailBuilderImpl.unorderedInputs(RelRule.java:324)
        at 
OurSpecialTopSecretRule$Config.lambda$static$5(OurSpecialTopSecretRule.java:98)
{code}

The idea is that we should match a join with these operands, which can appear 
in either order.

> RelOptRuleOperand Assertion error with UNORDERED child policy when more than 
> 1 child
> ------------------------------------------------------------------------------------
>
>                 Key: CALCITE-7237
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7237
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Ian Bertolacci
>            Priority: Major
>
> [In RelOptRuleOperand constructor, there is an assertion that if the policy 
> is UNORDERED, there must be exactly one 
> child.|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/plan/RelOptRuleOperand.java#L124-L125]
> However, there are many paths to this condition which claim (both literally 
> in comments, or through accepting multiple operands) that there *can* be 
> multiple children.
> - 
> [RelRule.OperandDetailBuilder.unorderedInputs|https://calcite.apache.org/javadocAggregate/org/apache/calcite/plan/RelRule.OperandDetailBuilder.html#unorderedInputs(org.apache.calcite.plan.RelRule.OperandTransform...)]
> - 
> [RelRule.OperandDetailBuilderImpl.unorderedInputs|https://github.com/apache/calcite/blob/92a1028d65efc3005eb22c3def97adefd9e8f2fc/core/src/main/java/org/apache/calcite/plan/RelRule.java#L319-L324]
> - 
> [HepPlanner|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/plan/hep/HepPlanner.java#L616]
> It seems like theres a contradiction here.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to