You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Matrix42 (Jira)" <ji...@apache.org> on 2020/03/23 12:51:00 UTC

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

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)