Daniel Barclay (Drill) created DRILL-3760:
---------------------------------------------

             Summary: Casting interval to string and back to interval fails
                 Key: DRILL-3760
                 URL: https://issues.apache.org/jira/browse/DRILL-3760
             Project: Apache Drill
          Issue Type: Bug
          Components: Functions - Drill
            Reporter: Daniel Barclay (Drill)
            Assignee: Mehant Baid


Casting from an interval type to {{VARCHAR(...)}} and then casting back to the 
same interval type yields data format errors, for example:

{noformat}
0: jdbc:drill:drillbit=localhost> VALUES CAST( CAST( INTERVAL '1' MONTH AS 
VARCHAR(99) ) AS INTERVAL MONTH );
Error: SYSTEM ERROR: IllegalArgumentException: Invalid format: "0 years 1 month 
"


[Error Id: 339d28df-b687-47f0-b6ce-1f7732e41660 on dev-linux2:31010] 
(state=,code=0)
0: jdbc:drill:drillbit=localhost> 
{noformat}

The problem seems to be in casting from interval types to strings.  The SQL 
standard specifies that the result string has the syntax of a SQL literal, but 
Drill currently uses some other syntax:

{noformat}
0: jdbc:drill:drillbit=localhost> VALUES CAST( INTERVAL '1' YEAR AS VARCHAR(99) 
);
+-------------------+
|      EXPR$0       |
+-------------------+
| 1 year 0 months   |
+-------------------+
1 row selected (0.27 seconds)
0: jdbc:drill:drillbit=localhost> 
{noformat}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to