You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Volodymyr Vysotskyi (JIRA)" <ji...@apache.org> on 2019/03/03 13:08:00 UTC

[jira] [Resolved] (DRILL-4939) to_date function returns incorrect result

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

Volodymyr Vysotskyi resolved DRILL-4939.
----------------------------------------
       Resolution: Not A Problem
    Fix Version/s: 1.16.0

> to_date function returns incorrect result
> -----------------------------------------
>
>                 Key: DRILL-4939
>                 URL: https://issues.apache.org/jira/browse/DRILL-4939
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Data Types
>    Affects Versions: 1.9.0
>            Reporter: Khurram Faraaz
>            Priority: Critical
>             Fix For: 1.16.0
>
>
> to_date function returns wrong result
> correct results from Postgres
> {noformat}
> postgres=# values(to_date('2016-09-22','yyyy-mm-dd'));
>   column1
> ------------
>  2016-09-22
> (1 row)
> {noformat}
> wrong results returned by Drill 1.9.0 git commit id: 4edabe7a
> {noformat}
> : jdbc:drill:schema=dfs.tmp> values(to_date('2016-09-22','yyyy-mm-dd'));
> +-------------+
> |   EXPR$0    |
> +-------------+
> | 2016-01-22  |
> +-------------+
> 1 row selected (0.125 seconds)
> {noformat}
> Postgres 9.3 returns true for below query whereas drill 1.9.0 returns false.
> {noformat}
> 0: jdbc:drill:schema=dfs.tmp> select (res1 = to_date('2016-09-22','yyyy-mm-dd')) res2
> . . . . . . . . . . . . . . > from
> . . . . . . . . . . . . . . > (
> . . . . . . . . . . . . . . >     select (case when (false) then null else cast('2016/09/22' as date) end) res1
> . . . . . . . . . . . . . . >     from (values(1)) foo
> . . . . . . . . . . . . . . > ) foobar;
> +--------+
> |  res2  |
> +--------+
> | false  |
> +--------+
> 1 row selected (0.146 seconds)
> postgres=# select (res1 = to_date('2016/09/22','yyyy-mm-dd')) res2
> postgres-# from
> postgres-# (
> postgres(#     select (case when (false) then null else cast('2016/09/22' as date) end) res1
> postgres(#     from (values(1)) foo
> postgres(# ) foobar;
>  res2
> ------
>  t
> (1 row)
> {noformat}
> Postgres 9.3 returns an error for below query, where as Drill git commit ID: 4edabe7a returns some results.
> This looks like it has to do with the to_date function in drill.
> {noformat}
> 0: jdbc:drill:schema=dfs.tmp> select (res1 = to_date(2016/09/22)) res2
> . . . . . . . . . . . . . . > from
> . . . . . . . . . . . . . . > (
> . . . . . . . . . . . . . . >     select (case when (false) then null else cast('2016/09/22' as date) end) res1
> . . . . . . . . . . . . . . >     from (values(1)) foo
> . . . . . . . . . . . . . . > ) foobar;
> +--------+
> |  res2  |
> +--------+
> | false  |
> +--------+
> 1 row selected (0.166 seconds)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)