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

AbstractRelNode#getId can overflow into a negative value causing CompileException in certain Enumerable implement methods

    XMLWordPrintableJSON

Details

    Description

      AbstractRelNode#getId can overflow into a negative value.
      This id is used by the implement method of several Enumerable operators (EnumerableBatchNestedLoopJoin and EnumerableMergeUnion) to guarantee a unique variable name in the dynamic code, e.g.:

      final ParameterExpression corrArgList =
          Expressions.parameter(Modifier.FINAL,
              List.class, "corrList" + this.getId());
      

      However, if the id is negative, this variable name will have a "-", causing a CompileException:

      ...
      final org.apache.calcite.linq4j.Enumerable _inputEnumerable1 = org.apache.calcite.linq4j.EnumerableDefaults.correlateBatchJoin(org.apache.calcite.linq4j.JoinType.LEFT, left0, new org.apache.calcite.linq4j.function.Function1() {
        public org.apache.calcite.linq4j.AbstractEnumerable apply(final java.util.List corrList-1794407755) {
      ...
      Caused by: java.util.concurrent.ExecutionException: org.codehaus.commons.compiler.CompileException: Line 134, Column 103: One of ', )' expected instead of '-'
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m