You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Yun Gao (Jira)" <ji...@apache.org> on 2022/04/13 06:28:06 UTC

[jira] [Updated] (FLINK-17683) Pojo with no-args constructor will be treated as ROW when returned by ScalarFunction, but not when it is a field of case class.

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

Yun Gao updated FLINK-17683:
----------------------------
    Fix Version/s: 1.16.0

> Pojo with no-args constructor will be treated as ROW when returned by ScalarFunction, but not when it is a field of case class.
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-17683
>                 URL: https://issues.apache.org/jira/browse/FLINK-17683
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.10.1
>            Reporter: xiemeilong
>            Priority: Minor
>              Labels: auto-deprioritized-major, auto-unassigned
>             Fix For: 1.15.0, 1.16.0
>
>
> Pojo.java
> {code:java}
> @Data
> @NoArgsConstructor
> public class Pojo  {
>     private String foo;
> }
> {code}
> {code:java}
> object Fun extends ScalarFunction { 
>    def eval(): Pojo = { new Pojo() } 
> }
> case class CaseClass(pojo:Pojo)
> {code}
>  
>  
> {code:java}
> tableEnv.registerFunction("fun", Fun)
> val table = tableEnv.sqlQuery("select fun() as pojo")
> table.toRetractStream[CaseClass].print()
> {code}
>  
> exception:
>  
> {code:java}
> Exception in thread "main" org.apache.flink.table.api.ValidationException: Field types of query result and registered TableSink  do not match.
> Query schema: [pojo: ROW<`foo` STRING>]
> Sink schema: [pojo: LEGACY('STRUCTURED_TYPE', 'POJO<com.yunmo.iot.Pojo>')]
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)