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

Mehant Baid updated DRILL-1140:
-------------------------------

    Attachment: DRILL-1140.patch

You are trying to cast a String to a Time column. We only support the following 
format for casting to Time 'hh:mm:ss'. However the input represents a TimeStamp 
and is in the format 'yyyy-mm-dd hh:mm:ss' type so casting to Time should give 
you an exception. Although you should be able to cast a TimeStamp to Time and 
this patch adds a simple cast function to be able to do so.

> Casting of a timestamp to time fails
> ------------------------------------
>
>                 Key: DRILL-1140
>                 URL: https://issues.apache.org/jira/browse/DRILL-1140
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>            Reporter: Krystal
>            Assignee: Mehant Baid
>         Attachments: DRILL-1140.patch
>
>
> git.commit.id.abbrev=699851b
> 0: jdbc:drill:schema=dfs> select cast(create_time as timestamp) from voter 
> where voter_id=1;
> +------------+
> |   EXPR$0   |
> +------------+
> | 2014-05-25 03:41:54.0 |
> +------------+
> 0: jdbc:drill:schema=dfs> select cast(create_time as time) from voter where 
> voter_id=1;
> message: "Failure while running fragment. < IllegalArgumentException:[ 
> Invalid format: "2014-05-25 03:41:54" is malformed at "14-05-25 03:41:54" ]"
> The same query from oracle and postgres return the time portion of the 
> timestamp.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to