James Mcguire created FLINK-31320:
-------------------------------------

             Summary: Modify DATE_FORMAT system (built-in) function to accepts 
DATEs
                 Key: FLINK-31320
                 URL: https://issues.apache.org/jira/browse/FLINK-31320
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / API
            Reporter: James Mcguire


The current {{DATE_FORMAT}} function only supports {{{}TIMESTAMP{}}}s. 

(See 
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/functions/systemfunctions/#temporal-functions)

 

Ideally, it should be able to format {{{}DATE{}}}'s as well as {{TIMESTAMPs}}

 

Example usage:
{noformat}
Flink SQL> CREATE TABLE test_table (
>   some_date DATE,
>   object AS JSON_OBJECT(
>     KEY 'some_date' VALUE DATE_FORMAT(some_date, 'YYYY-MM-dd')
>   )
> )
> COMMENT ''
> WITH (
>   'connector'='datagen'
> )
> ;
> 
[ERROR] Could not execute SQL statement. Reason:
org.apache.calcite.sql.validate.SqlValidatorException: Cannot apply 
'DATE_FORMAT' to arguments of type 'DATE_FORMAT(<DATE>, <CHAR(10)>)'. Supported 
form(s): 'DATE_FORMAT(<TIMESTAMP>, <STRING>)'
'DATE_FORMAT(<STRING>, <STRING>)'{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to