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

Jark Wu reassigned FLINK-16727:
-------------------------------

    Assignee: Jark Wu

> cannot cast 2020-11-12 as class java.time.LocalDate
> ---------------------------------------------------
>
>                 Key: FLINK-16727
>                 URL: https://issues.apache.org/jira/browse/FLINK-16727
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.10.0
>         Environment: [^Flinktest.zip]
>            Reporter: Matrix42
>            Assignee: Jark Wu
>            Priority: Major
>             Fix For: 1.10.1, 1.11.0
>
>         Attachments: Flinktest.zip
>
>
> I defined as ScalarFunction as follow:
>  
> {code:java}
> public class DateFunc extends ScalarFunction {
>     public String eval(Date date) {
>       return date.toString();
>     }
>     @Override
>     public TypeInformation<?> getResultType(Class<?>[] signature) {
>         return Types.STRING;
>     }
>    @Override
>    public TypeInformation<?>[] getParameterTypes(Class<?>[] signature) {
>       return new TypeInformation[]{Types.INT};
>    }
> }
> {code}
> I ues it in sql: `select func(DATE '2020-11-12') as a from source` , Flink 
> throws 'cannot cast 2020-11-12 as class java.time.LocalDate '
>  
> The full code is in the [^Flinktest.zip] Main class is 
> com.lorinda.template.TestDateFunction



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

Reply via email to