You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Rui Li (Jira)" <ji...@apache.org> on 2020/02/10 08:54:00 UTC

[jira] [Commented] (FLINK-15965) DATE literal issue in static partition spec

    [ https://issues.apache.org/jira/browse/FLINK-15965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17033443#comment-17033443 ] 

Rui Li commented on FLINK-15965:
--------------------------------

The issue can be worked around by changing the DML to:
{noformat}
insert into foo partition (p1='2020-01-24') select ...,...;
{noformat}
But it's better if we support explicit DATE literals.

cc [~lzljs3620320]

> DATE literal issue in static partition spec
> -------------------------------------------
>
>                 Key: FLINK-15965
>                 URL: https://issues.apache.org/jira/browse/FLINK-15965
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>            Reporter: Rui Li
>            Priority: Minor
>
> Suppose I have a table with a DATE partition column. The following DML would fail:
> {noformat}
> Flink SQL> insert into foo partition (p1=date '2020-01-24') select ..., ...;
> [INFO] Submitting SQL update statement to the cluster...
> [ERROR] Could not execute SQL statement. Reason:
> java.lang.IllegalArgumentException: not a literal: DATE '2020-01-24'
> {noformat}
> Not sure why {{DATE '2020-01-24'}} is not considered a literal. And changing it to a CAST doesn't work either:
> {noformat}
> Flink SQL> insert into foo partition (p1=cast('2020-01-24' as date)) select ...,...;
> [INFO] Submitting SQL update statement to the cluster...
> [ERROR] Could not execute SQL statement. Reason:
> org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "cast" at line 1, column 35.
> Was expecting one of:
>     "DATE" ...
>     "FALSE" ...
>     "INTERVAL" ...
>     "NULL" ...
>     "TIME" ...
>     "TIMESTAMP" ...
>     "TRUE" ...
>     "UNKNOWN" ...
>     <UNSIGNED_INTEGER_LITERAL> ...
>     <APPROX_NUMERIC_LITERAL> ...
>     <DECIMAL_NUMERIC_LITERAL> ...
>     <BINARY_STRING_LITERAL> ...
>     <QUOTED_STRING> ...
>     <PREFIXED_STRING_LITERAL> ...
>     <UNICODE_STRING_LITERAL> ...
>     <LBRACE_D> ...
>     <LBRACE_T> ...
>     <LBRACE_TS> ...
>     "+" ...
>     "-" ...
> {noformat}



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