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 2014/07/22 01:02:39 UTC

[jira] [Commented] (DRILL-1165) Cast a varchar timestamp into date fails

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

Krystal commented on DRILL-1165:
--------------------------------

Server Error:

java.lang.IllegalArgumentException: Invalid format: "2014-11-12 12:38:15" is malformed at "14-11-12 12:38:15"
org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:873) ~[joda-time-2.3.jar:2.3]
org.apache.drill.exec.test.generated.ProjectorGen109.doEval(ProjectorTemplate.java:72) ~[na:na]
org.apache.drill.exec.test.generated.ProjectorGen109.projectRecords(ProjectorTemplate.java:66) ~[na:na]
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.doWork(ProjectRecordBatch.java:109) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:78) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:95) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:91) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:116) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:58) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext(ScreenCreator.java:97) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:48) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:100) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.work.WorkManager$RunnableWrapper.run(WorkManager.java:242) [drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]

> Cast a varchar timestamp into date fails 
> -----------------------------------------
>
>                 Key: DRILL-1165
>                 URL: https://issues.apache.org/jira/browse/DRILL-1165
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>            Reporter: Krystal
>
> git.commit.id.abbrev=e5c2da0
> I have the following varchar data casted as timestamp:
> 0: jdbc:drill:schema=dfs> select cast(create_time as timestamp) from student where student_id=15;
> +------------+
> |   EXPR$0   |
> +------------+
> | 2014-11-12 12:38:15.0 |
> I can cast the varchar data to a date:
> 0: jdbc:drill:schema=dfs> select cast(create_time as date) from student where student_id=15;
> +------------+
> |   EXPR$0   |
> +------------+
> | 2014-11-12 |
> +------------+
> However, it fails when I tried to cast it to a time:
> 0: jdbc:drill:schema=dfs> select cast(create_time as time) from student where student_id=15;
> message: "Failure while running fragment. < IllegalArgumentException:[ Invalid format: "2014-11-12 12:38:15" is malformed at "14-11-12 12:38:15" ]"
> If it works for date, it should work for time.  This query returned the time portion of the string when executed from postgres.



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