You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jark Wu (Jira)" <ji...@apache.org> on 2022/07/21 08:51:00 UTC

[jira] [Created] (FLINK-28620) SQL Client doesn't properly print values of INTERVAL type

Jark Wu created FLINK-28620:
-------------------------------

             Summary: SQL Client doesn't properly print values of INTERVAL type
                 Key: FLINK-28620
                 URL: https://issues.apache.org/jira/browse/FLINK-28620
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Client
            Reporter: Jark Wu
            Assignee: Jark Wu
             Fix For: 1.16.0


The display of values of interval type should follow the CAST rules. However, currently, SQL Client prints it using {{Period.toString()}} and {{Duration.toString()}} which is not SQL standard compliant. 

{code}
Flink SQL> select interval '9-11' year to month;
+--------+
| EXPR$0 |
+--------+
|  P119M |
+--------+
1 row in set

Flink SQL> select cast(interval '9-11' year to month as varchar);
+--------+
| EXPR$0 |
+--------+
|  +9-11 |
+--------+
1 row in set

Flink SQL> select interval '2 1:2:3' day to second;
+-----------+
|    EXPR$0 |
+-----------+
| PT49H2M3S |
+-----------+
1 row in set

Flink SQL> select cast(interval '2 1:2:3' day to second as varchar);
+-----------------+
|          EXPR$0 |
+-----------------+
| +2 01:02:03.000 |
+-----------------+
1 row in set
{code}



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