[ 
https://issues.apache.org/jira/browse/BEAM-12473?focusedWorklogId=610698&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-610698
 ]

ASF GitHub Bot logged work on BEAM-12473:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Jun/21 14:25
            Start Date: 14/Jun/21 14:25
    Worklog Time Spent: 10m 
      Work Description: je-ik commented on pull request #14986:
URL: https://github.com/apache/beam/pull/14986#issuecomment-860728023


   @ibzib ready for another round. The added commit should be squashed before 
merge. I also fixed additional bug in `CalciteUtils` with handling of nested 
ParameterizedTypes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 610698)
    Time Spent: 1h  (was: 50m)

> ClassCastException when using registerUdaf in Calcite SQL
> ---------------------------------------------------------
>
>                 Key: BEAM-12473
>                 URL: https://issues.apache.org/jira/browse/BEAM-12473
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-sql
>    Affects Versions: 2.31.0
>            Reporter: Jan Lukavský
>            Assignee: Jan Lukavský
>            Priority: P2
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> When using {{registerUdaf}} as follows:
> {code:java}
>                 .registerUdaf(
>                     "LONGEST_WORD",
>                     Max.of(
>                         (Comparator<String> & Serializable)
>                             (String a, String b) -> 
> Integer.compare(a.length(), b.length()))))
> {code}
>  results in following exception:
> {noformat}
> Caused by: java.lang.ClassCastException: class 
> sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to 
> class java.lang.Class 
> (sun.reflect.generics.reflectiveObjects.TypeVariableImpl and java.lang.Class 
> are in module java.base of loader 'bootstrap')
>       at 
> org.apache.beam.sdk.extensions.sql.impl.utils.CalciteUtils.sqlTypeWithAutoCast(CalciteUtils.java:327)
>       at 
> org.apache.beam.sdk.extensions.sql.impl.UdafImpl$1.getType(UdafImpl.java:73)
>       at 
> org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.prepare.CalciteCatalogReader.toOp(CalciteCatalogReader.java:315)
>       at 
> org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.prepare.CalciteCatalogReader.toOp(CalciteCatalogReader.java:302)
>       at 
> org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.prepare.CalciteCatalogReader.lambda$lookupOperatorOverloads$3(CalciteCatalogReader.java:271)
>       at 
> java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
>       at 
> java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
> {noformat}
> If this way of registering UDAF is not supported, it should throw a more 
> user-friendly exception.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to