[jira] [Created] (FLINK-16727) cannot cast 2020-11-12 as class java.time.LocalDate

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-16727) cannot cast 2020-11-12 as class java.time.LocalDate

Shang Yuanchun (Jira)
Matrix42 created FLINK-16727:
--------------------------------

             Summary: 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
         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)