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

RexToLixTranslator does not generate correct declaration of Methods with generic return types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.16.0
    • 1.18.0
    • None
    • None

    Description

      We have an user defined function like below:

      public class Identity<I> implements Function<I, I> {
        @Override
        public I apply(I i) {
          return i;
        }
      }
      

      We have a projection that applies the function twice and then the generated statement contains the type parameter instead of a valid Java type.

      final I v = new Identity().apply(current[0] == null ? (String) null : current[0].toString());
      

      After tracing through the code for a while it looks like the MethodCallExpression uses Method.getGenericReturnType.

      https://github.com/apache/calcite/blob/master/linq4j/src/main/java/org/apache/calcite/linq4j/tree/MethodCallExpression.java#L53

      I guess this should be changed to Method.getReturnType instead.

      Attachments

        Activity

          People

            julianhyde Julian Hyde
            arunmahadevan Arun Mahadevan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: