You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Krystal (JIRA)" <ji...@apache.org> on 2015/11/10 19:27:11 UTC

[jira] [Updated] (DRILL-3760) Casting interval to string and back to interval fails

     [ https://issues.apache.org/jira/browse/DRILL-3760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Krystal updated DRILL-3760:
---------------------------
    Labels: interval  (was: )

> 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)
>              Labels: interval
>             Fix For: Future
>
>
> 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)