Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-6600

AggregateJoinTransposeRule can throw ArrayIndexOutOfBoundsException when applied on a SemiJoin

    XMLWordPrintableJSON

Details

    Description

      AggregateJoinTransposeRule can throw ArrayIndexOutOfBoundsException when applied on a SemiJoin, because it creates a mapping containing the Join's field count (which in case of a SemiJoin is just the LHS field count), and said mapping is used to process the (Semi)Join condition, which can contain references to the RHS fields.

      The exception looks like:

      Index 2 out of bounds for length 2
      java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2
      	at org.apache.calcite.util.mapping.Mappings$PartialFunctionImpl.getTargetOpt(Mappings.java:1780)
      	at org.apache.calcite.util.mapping.Mappings$AbstractMapping.getTarget(Mappings.java:943)
      	at org.apache.calcite.rex.RexPermuteInputsShuttle.visitInputRef(RexPermuteInputsShuttle.java:87)
      	at org.apache.calcite.rex.RexPermuteInputsShuttle.visitInputRef(RexPermuteInputsShuttle.java:35)
      	at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:125)
      	at org.apache.calcite.rex.RexShuttle.visitList(RexShuttle.java:167)
      	at org.apache.calcite.rex.RexShuttle.visitCall(RexShuttle.java:119)
      	at org.apache.calcite.rex.RexPermuteInputsShuttle.visitCall(RexPermuteInputsShuttle.java:102)
      	at org.apache.calcite.rex.RexPermuteInputsShuttle.visitCall(RexPermuteInputsShuttle.java:35)
      	at org.apache.calcite.rex.RexCall.accept(RexCall.java:208)
      	at org.apache.calcite.rex.RexUtil.apply(RexUtil.java:1516)
      	at org.apache.calcite.rel.rules.AggregateJoinTransposeRule.onMatch(AggregateJoinTransposeRule.java:329)
      ...
      

      Attachments

        Issue Links

          Activity

            People

              rubenql Ruben Q L
              rubenql Ruben Q L
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: