You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Arun Mahadevan (JIRA)" <ji...@apache.org> on 2018/07/13 00:07:00 UTC

[jira] [Updated] (CALCITE-2413) RexToLixTranslator does not generate correct declaration of Methods with generic return types

     [ https://issues.apache.org/jira/browse/CALCITE-2413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arun Mahadevan updated CALCITE-2413:
------------------------------------
    Description: 
We have an user defined function like below:
{code:java}
public class Identity<I> implements Function<I, I> {
  @Override
  public I apply(I i) {
    return i;
  }
}
{code}
We have a projection that applies the function twice and then the generated statement contains the type parameter instead of a valid Java type.
{code:java}
final I v = new Identity().apply(current[0] == null ? (String) null : current[0].toString());
{code}
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.

  was:
We have an user defined function like below:
{code:java}
public class Identity<I> implements Function<I, I> {
  @Override
  public I apply(I i) {
    return i;
  }
}
{code}

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

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

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

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.




> RexToLixTranslator does not generate correct declaration of Methods with generic return types
> ---------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2413
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2413
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.16.0
>            Reporter: Arun Mahadevan
>            Assignee: Julian Hyde
>            Priority: Critical
>
> We have an user defined function like below:
> {code:java}
> public class Identity<I> implements Function<I, I> {
>   @Override
>   public I apply(I i) {
>     return i;
>   }
> }
> {code}
> We have a projection that applies the function twice and then the generated statement contains the type parameter instead of a valid Java type.
> {code:java}
> final I v = new Identity().apply(current[0] == null ? (String) null : current[0].toString());
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)